chromium/out/Default/gen/chrome/common/extensions/api/tabs.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// GENERATED FROM THE API DEFINITION IN
//   chrome/common/extensions/api/tabs.json
// by tools/json_schema_compiler.
// DO NOT EDIT.

#ifndef CHROME_COMMON_EXTENSIONS_API_TABS_H__
#define CHROME_COMMON_EXTENSIONS_API_TABS_H__

#include <stdint.h>

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "base/values.h"
#include <string_view>
#include "extensions/common/api/extension_types.h"
#include "chrome/common/extensions/api/windows.h"


namespace extensions {
namespace api {
namespace extension_types {
struct ImageDetails;
}  // namespace extension_types
}  // namespace api
}  // namespace extensions

namespace extensions {
namespace api {
namespace tabs {

//
// Properties
//

// The maximum number of times that $(ref:captureVisibleTab) can be called per
// second. $(ref:captureVisibleTab) is expensive and should not be called too
// often.
extern const int MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND;

// An ID that represents the absence of a browser tab.
extern const int TAB_ID_NONE;

// An index that represents the absence of a tab index in a tab_strip.
extern const int TAB_INDEX_NONE;

//
// Types
//

// The tab's loading status.
enum class TabStatus {};


const char* ToString(TabStatus as_enum);
TabStatus ParseTabStatus(std::string_view as_string);
std::u16string GetTabStatusParseError(std::string_view as_string);

// An event that caused a muted state change.
enum class MutedInfoReason {};


const char* ToString(MutedInfoReason as_enum);
MutedInfoReason ParseMutedInfoReason(std::string_view as_string);
std::u16string GetMutedInfoReasonParseError(std::string_view as_string);

// The tab's muted state and the reason for the last state change.
struct MutedInfo {};

struct Tab {};

// Defines how zoom changes are handled, i.e., which entity is responsible for
// the actual scaling of the page; defaults to <code>automatic</code>.
enum class ZoomSettingsMode {};


const char* ToString(ZoomSettingsMode as_enum);
ZoomSettingsMode ParseZoomSettingsMode(std::string_view as_string);
std::u16string GetZoomSettingsModeParseError(std::string_view as_string);

// Defines whether zoom changes persist for the page's origin, or only take
// effect in this tab; defaults to <code>per-origin</code> when in
// <code>automatic</code> mode, and <code>per-tab</code> otherwise.
enum class ZoomSettingsScope {};


const char* ToString(ZoomSettingsScope as_enum);
ZoomSettingsScope ParseZoomSettingsScope(std::string_view as_string);
std::u16string GetZoomSettingsScopeParseError(std::string_view as_string);

// Defines how zoom changes in a tab are handled and at what scope.
struct ZoomSettings {};

// The type of window.
enum class WindowType {};


const char* ToString(WindowType as_enum);
WindowType ParseWindowType(std::string_view as_string);
std::u16string GetWindowTypeParseError(std::string_view as_string);


//
// Functions
//

namespace Get {

struct Params {};

namespace Results {

base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace Get

namespace GetCurrent {

namespace Results {

base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace GetCurrent

namespace GetSelected {

struct Params {};

namespace Results {

base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace GetSelected

namespace GetAllInWindow {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<Tab>& tabs);
}  // namespace Results

}  // namespace GetAllInWindow

namespace Create {

struct Params {};

namespace Results {

// The created tab.
base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace Create

namespace Duplicate {

struct Params {};

namespace Results {

// Details about the duplicated tab. The $(ref:tabs.Tab) object does not contain
// <code>url</code>, <code>pendingUrl</code>, <code>title</code>, and
// <code>favIconUrl</code> if the <code>"tabs"</code> permission has not been
// requested.
base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace Duplicate

namespace Query {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<Tab>& result);
}  // namespace Results

}  // namespace Query

namespace Highlight {

struct Params {};

namespace Results {

// Contains details about the window whose tabs were highlighted.
base::Value::List Create(const extensions::api::windows::Window& window);
}  // namespace Results

}  // namespace Highlight

namespace Update {

struct Params {};

namespace Results {

// Details about the updated tab. The $(ref:tabs.Tab) object does not contain
// <code>url</code>, <code>pendingUrl</code>, <code>title</code>, and
// <code>favIconUrl</code> if the <code>"tabs"</code> permission has not been
// requested.
base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace Update

namespace Move {

struct Params {};

namespace Results {

// Details about the moved tabs.
struct Tabs {};


// Details about the moved tabs.
base::Value::List Create(const Tabs& tabs);
}  // namespace Results

}  // namespace Move

namespace Reload {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace Reload

namespace Remove {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace Remove

namespace Group {

struct Params {};

namespace Results {

// The ID of the group that the tabs were added to.
base::Value::List Create(int group_id);
}  // namespace Results

}  // namespace Group

namespace Ungroup {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace Ungroup

namespace DetectLanguage {

struct Params {};

namespace Results {

// An ISO language code such as <code>en</code> or <code>fr</code>. For a
// complete list of languages supported by this method, see <a
// href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguageInfoTable</a>. The second to fourth columns are checked and the first non-NULL value is returned, except for Simplified Chinese for which <code>zh-CN</code> is returned. For an unknown/undefined language, <code>und</code> is returned.
base::Value::List Create(const std::string& language);
}  // namespace Results

}  // namespace DetectLanguage

namespace CaptureVisibleTab {

struct Params {};

namespace Results {

// A data URL that encodes an image of the visible area of the captured tab. May
// be assigned to the 'src' property of an HTML <code>img</code> element for
// display.
base::Value::List Create(const std::string& data_url);
}  // namespace Results

}  // namespace CaptureVisibleTab

namespace ExecuteScript {

struct Params {};

namespace Results {

// The result of the script in every injected frame.
base::Value::List Create(const base::Value::List& result);
}  // namespace Results

}  // namespace ExecuteScript

namespace InsertCSS {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace InsertCSS

namespace RemoveCSS {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace RemoveCSS

namespace SetZoom {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace SetZoom

namespace GetZoom {

struct Params {};

namespace Results {

// The tab's current zoom factor.
base::Value::List Create(double zoom_factor);
}  // namespace Results

}  // namespace GetZoom

namespace SetZoomSettings {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace SetZoomSettings

namespace GetZoomSettings {

struct Params {};

namespace Results {

// The tab's current zoom settings.
base::Value::List Create(const ZoomSettings& zoom_settings);
}  // namespace Results

}  // namespace GetZoomSettings

namespace Discard {

struct Params {};

namespace Results {

// The discarded tab, if it was successfully discarded; undefined otherwise.
base::Value::List Create(const Tab& tab);
}  // namespace Results

}  // namespace Discard

namespace GoForward {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace GoForward

namespace GoBack {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace GoBack

//
// Events
//

namespace OnCreated {

extern const char kEventName[];  // "tabs.onCreated"

// Details of the tab that was created.
base::Value::List Create(const Tab& tab);
}  // namespace OnCreated

namespace OnUpdated {

extern const char kEventName[];  // "tabs.onUpdated"

// Lists the changes to the state of the tab that was updated.
struct ChangeInfo {};


// Lists the changes to the state of the tab that was updated.
// Gives the state of the tab that was updated.
base::Value::List Create(int tab_id, const ChangeInfo& change_info, const Tab& tab);
}  // namespace OnUpdated

namespace OnMoved {

extern const char kEventName[];  // "tabs.onMoved"

struct MoveInfo {};


base::Value::List Create(int tab_id, const MoveInfo& move_info);
}  // namespace OnMoved

namespace OnSelectionChanged {

extern const char kEventName[];  // "tabs.onSelectionChanged"

struct SelectInfo {};


// The ID of the tab that has become active.
base::Value::List Create(int tab_id, const SelectInfo& select_info);
}  // namespace OnSelectionChanged

namespace OnActiveChanged {

extern const char kEventName[];  // "tabs.onActiveChanged"

struct SelectInfo {};


// The ID of the tab that has become active.
base::Value::List Create(int tab_id, const SelectInfo& select_info);
}  // namespace OnActiveChanged

namespace OnActivated {

extern const char kEventName[];  // "tabs.onActivated"

struct ActiveInfo {};


base::Value::List Create(const ActiveInfo& active_info);
}  // namespace OnActivated

namespace OnHighlightChanged {

extern const char kEventName[];  // "tabs.onHighlightChanged"

struct SelectInfo {};


base::Value::List Create(const SelectInfo& select_info);
}  // namespace OnHighlightChanged

namespace OnHighlighted {

extern const char kEventName[];  // "tabs.onHighlighted"

struct HighlightInfo {};


base::Value::List Create(const HighlightInfo& highlight_info);
}  // namespace OnHighlighted

namespace OnDetached {

extern const char kEventName[];  // "tabs.onDetached"

struct DetachInfo {};


base::Value::List Create(int tab_id, const DetachInfo& detach_info);
}  // namespace OnDetached

namespace OnAttached {

extern const char kEventName[];  // "tabs.onAttached"

struct AttachInfo {};


base::Value::List Create(int tab_id, const AttachInfo& attach_info);
}  // namespace OnAttached

namespace OnRemoved {

extern const char kEventName[];  // "tabs.onRemoved"

struct RemoveInfo {};


base::Value::List Create(int tab_id, const RemoveInfo& remove_info);
}  // namespace OnRemoved

namespace OnReplaced {

extern const char kEventName[];  // "tabs.onReplaced"

base::Value::List Create(int added_tab_id, int removed_tab_id);
}  // namespace OnReplaced

namespace OnZoomChange {

extern const char kEventName[];  // "tabs.onZoomChange"

struct ZoomChangeInfo {};


base::Value::List Create(const ZoomChangeInfo& zoom_change_info);
}  // namespace OnZoomChange

}  // namespace tabs
}  // namespace api
}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_API_TABS_H__