chromium/tools/json_schema_compiler/test/tabs.json

[
  {
    "namespace": "tabs",
    "description": "The tabs API.",
    "types": [
      {
        "id": "Tab",
        "type": "object",
        "properties": {
          "id": {"type": "integer", "minimum": 0, "description": "The ID of the tab. Tab IDs are unique within a browser session."},
          "index": {"type": "integer", "minimum": 0, "description": "The zero-based index of the tab within its window."},
          "windowId": {"type": "integer", "minimum": 0, "description": "The ID of the window the tab is contained within."},
          "selected": {"type": "boolean", "description": "Whether the tab is selected.", "nodoc": true},
          "highlighted": {"type": "boolean", "description": "Whether the tab is highlighted."},
          "active": {"type": "boolean", "description": "Whether the tab is active in its window."},
          "pinned": {"type": "boolean", "description": "Whether the tab is pinned."},
          "url": {"type": "string", "description": "The URL the tab is displaying."},
          "title": {"type": "string", "optional": true, "description": "The title of the tab. This may not be available if the tab is loading."},
          "favIconUrl": {"type": "string", "optional": true, "description": "The URL of the tab's favicon. This may not be available if the tab is loading."},
          "status": {"type": "string", "optional": true, "description": "Either <em>loading</em> or <em>complete</em>."},
          "incognito": {"type": "boolean", "description": "Whether the tab is in an incognito window."}
        }
      }
    ],
    "functions": [
      {
        "name": "get",
        "type": "function",
        "description": "Retrieves details about the specified tab.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {"name": "tab", "$ref": "Tab"}
          ]
        }
      },
      {
        "name": "getCurrent",
        "type": "function",
        "description": "Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "tab",
              "$ref": "Tab",
              "optional": true
            }
          ]
        }
      },
      {
        "name": "connect",
        "nocompile": true,
        "type": "function",
        "description": "Connects to the content script(s) in the specified tab. The <a href='extension.html#event-onConnect'>chrome.runtime.onConnect</a> event is fired in each content script running in the specified tab for the current extension. For more details, see <a href='content_scripts.html#messaging'>Content Script Messaging</a>.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0
          },
          {
            "type": "object",
            "name": "connectInfo",
            "properties": {
              "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for content scripts that are listening for the connection event." }
            },
            "optional": true
          }
        ],
        "returns": {
          "$ref": "Port",
          "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's <a href='extension.html#type-Port'>onDisconnect</a> event is fired if the tab closes or does not exist. "
        }
      },
      {
        "name": "sendRequest",
        "nocompile": true,
        "type": "function",
        "description": "Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back.  The <a href='extension.html#event-onRequest'>chrome.extension.onRequest</a> event is fired in each content script running in the specified tab for the current extension.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0
          },
          {
            "type": "any",
            "name": "request"
          }
        ],
        "returns_async": {
          "name": "responseCallback",
          "optional": true,
          "parameters": [
            {
              "name": "response",
              "type": "any",
              "description": "The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href='extension.html#property-lastError'>chrome.runtime.lastError</a> will be set to the error message."
            }
          ]
        }
      },
      {
        "name": "getSelected",
        "nodoc": true,
        "type": "function",
        "description": "Deprecated. Please use query({'active': true}). Gets the tab that is selected in the specified window.",
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "minimum": 0,
            "optional": true,
            "description": "Defaults to the <a href='windows.html#current-window'>current window</a>."
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {"name": "tab", "$ref": "Tab"}
          ]
        }
      },
      {
        "name": "getAllInWindow",
        "type": "function",
        "nodoc": true,
        "description": "Deprecated. Please use query({'windowId': windowId}). Gets details about all tabs in the specified window.",
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "minimum": 0,
            "optional": true,
            "description": "Defaults to the <a href='windows.html#current-window'>current window</a>."
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {"name": "tabs", "type": "array", "items": { "$ref": "Tab" } }
          ]
        }
      },
      {
        "name": "create",
        "type": "function",
        "description": "Creates a new tab. Note: This function can be used without requesting the 'tabs' permission in the manifest.",
        "parameters": [
          {
            "type": "object",
            "name": "createProperties",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": 0,
                "optional": true,
                "description": "The window to create the new tab in. Defaults to the <a href='windows.html#current-window'>current window</a>."
              },
              "index": {
                "type": "integer",
                "minimum": 0,
                "optional": true,
                "description": "The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window."
              },
              "url": {
                "type": "string",
                "optional": true,
                "description": "The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page."
              },
              "active": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should become the active tab in the window. Defaults to <var>true</var>"
              },
              "selected": {
                "nodoc": true,
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should become the selected tab in the window. Defaults to <var>true</var>"
              },
              "pinned": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should be pinned. Defaults to <var>false</var>"
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": [
            {
              "name": "tab",
              "$ref": "Tab",
              "description": "Details about the created tab. Will contain the ID of the new tab."
            }
          ]
        }
      },
      {
        "name": "query",
        "type": "function",
        "description": "Gets all tabs that have the specified properties, or all tabs if no properties are specified.",
        "parameters": [
          {
            "type": "object",
            "name": "queryInfo",
            "properties": {
              "active": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tabs are active in their windows."
              },
              "pinned": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tabs are pinned."
              },
              "highlighted": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tabs are highlighted."
              },
              "status": {
                "type": "string",
                "optional": true,
                "enum": ["loading", "complete"],
                "description": "Whether the tabs have completed loading."
              },
              "title": {
                "type": "string",
                "optional": true,
                "description": "Match page titles against a pattern."
              },
              "url": {
                "type": "string",
                "optional": true,
                "description": "Match tabs against a URL pattern."
              },
              "windowId": {
                "type": "integer",
                "optional": true,
                "minimum": 0,
                "description": "The ID of the parent window."
              },
              "windowType": {
                "type": "string",
                "optional": true,
                "enum": ["normal", "popup", "panel", "app", "devtools"],
                "description": "The type of window the tabs are in."
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "result",
              "type": "array",
              "items": {
                "$ref": "Tab"
              }
            }
          ]
        }
      },
      {
        "name": "highlight",
        "type": "function",
        "description": "Highlights the given tabs.",
        "parameters": [
          {
            "type": "object",
            "name": "highlightInfo",
            "properties": {
               "windowId": {
                 "type": "integer",
                 "description": "The window that contains the tabs."
               },
               "tabs": {
                 "description": "One or more tab indices to highlight.",
                 "choices": [
                   {"type": "array", "items": {"type": "integer", "minimum": 0}},
                   {"type": "integer"}
                 ]
               }
             }
           }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "window",
              "$ref": "Window",
              "description": "Contains details about the window whose tabs were highlighted."
            }
          ]
        }
      },
      {
        "name": "update",
        "type": "function",
        "description": "Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified. Note: This function can be used without requesting the 'tabs' permission in the manifest.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0,
            "optional": true,
            "description": "Defaults to the selected tab of the <a href='windows.html#current-window'>current window</a>."
          },
          {
            "type": "object",
            "name": "updateProperties",
            "properties": {
              "url": {
                "optional": true,
                "type": "string",
                "description": "A URL to navigate the tab to."
              },
              "active": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should be active."
              },
              "highlighted": {
                "type": "boolean",
                "optional": true,
                "description": "Adds or removes the tab from the current selection."
              },
              "selected": {
                "nodoc": true,
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should be selected."
              },
              "pinned": {
                "type": "boolean",
                "optional": true,
                "description": "Whether the tab should be pinned."
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": [
            {
              "name": "tab",
              "$ref": "Tab",
              "optional": true,
              "description": "Details about the updated tab, or <code>null</code> if the 'tabs' permission has not been requested."
            }
          ]
        }
      },
      {
        "name": "move",
        "type": "function",
        "description": "Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === \"normal\") windows.",
        "parameters": [
          {
            "name": "tabIds",
            "description": "The tab or list of tabs to move.",
            "choices": [
              {"type": "integer", "minimum": 0},
              {"type": "array", "items": {"type": "integer", "minimum": 0}}
            ]
          },
          {
            "type": "object",
            "name": "moveProperties",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": 0,
                "optional": true,
                "description": "Defaults to the window the tab is currently in."
              },
              "index": {
                "type": "integer",
                "minimum": 0,
                "description": "The position to move the window to. The provided value will be clamped to between zero and the number of tabs in the window."
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": [
            {
              "name": "tabs",
              "description": "Details about the moved tabs.",
              "choices": [
                {"$ref": "Tab"},
                {"type": "array", "items": {"$ref": "Tab"}}
              ]
            }
          ]
        }
      },
      {
        "name": "reload",
        "type": "function",
        "description": "Reload a tab.",
        "parameters": [
          {"type": "integer", "name": "tabId", "optional": true, "description": "The ID of the tab to reload; defaults to the selected tab of the current window."},
          {
            "type": "object",
            "name": "reloadProperties",
            "optional": true,
            "properties": {
              "bypassCache": {
                "type": "boolean",
                "optional": true,
                "description": "Whether using any local cache. Default is false."
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "remove",
        "type": "function",
        "description": "Closes one or more tabs. Note: This function can be used without requesting the 'tabs' permission in the manifest.",
        "parameters": [
          {
            "name": "tabIds",
            "description": "The tab or list of tabs to close.",
            "choices": [
              {"type": "integer", "minimum": 0},
              {"type": "array", "items": {"type": "integer", "minimum": 0}}
            ]
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "detectLanguage",
        "type": "function",
        "description": "Detects the primary language of the content in a tab.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0,
            "optional": true,
            "description": "Defaults to the active tab of the <a href='windows.html#current-window'>current window</a>."
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "type": "string",
              "name": "language",
              "description": "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 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, <code>und</code> will be returned."
            }
          ]
        }
      },
      {
        "name": "captureVisibleTab",
        "type": "function",
        "description": "Captures the visible area of the currently active tab in the specified window. You must have <a href='manifest.html#permissions'>&lt;all_urls&gt;</a> permission to use this method.",
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "minimum": 0,
            "optional": true,
            "description": "The target window. Defaults to the <a href='windows.html#current-window'>current window</a>."
          },
          {
            "type": "object",
            "name": "options",
            "optional": true,
            "description": "Set parameters of image capture, such as the format of the resulting image.",
            "properties": {
              "format": {
                "type": "string",
                "optional": true,
                "enum": ["jpeg", "png"],
                "description": "The format of the resulting image.  Default is jpeg."
              },
              "quality": {
                "type": "integer",
                "name": "quality",
                "optional": true,
                "minimum": 0,
                "maximum": 100,
                "description": "When format is 'jpeg', controls the quality of the resulting image.  This value is ignored for PNG images.  As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease."
              }
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {"type": "string", "name": "dataUrl", "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display."}
          ]
        }
      },
      {
        "name": "executeScript",
        "type": "function",
        "description": "Injects JavaScript code into a page. For details, see the <a href='content_scripts.html#pi'>programmatic injection</a> section of the content scripts doc.",
        "parameters": [
          {"type": "integer", "name": "tabId", "optional": true, "description": "The ID of the tab in which to run the script; defaults to the active tab of the current window."},
          {
            "type": "object",
            "name": "details",
            "description": "Details of the script to run. Either the code or the file property must be set, but both may not be set at the same time.",
            "properties": {
              "code": {"type": "string", "optional": true, "description": "JavaScript code to execute."},
              "file": {"type": "string", "optional": true, "description": "JavaScript file to execute."},
              "allFrames": {"type": "boolean", "optional": true, "description": "If allFrames is true, this function injects script into all frames of current page. By default, it's false and script is injected only into the top main frame."}
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "description": "Called after all the JavaScript has been executed.",
          "parameters": []
        }
      },
      {
        "name": "insertCSS",
        "type": "function",
        "description": "Injects CSS into a page. For details, see the <a href='content_scripts.html#pi'>programmatic injection</a> section of the content scripts doc.",
        "parameters": [
          {"type": "integer", "name": "tabId", "optional": true, "description": "The ID of the tab in which to insert the CSS; defaults to the active tab of the current window."},
          {
            "type": "object",
            "name": "details",
            "description": "Details of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time.",
            "properties": {
              "code": {"type": "string", "optional": true, "description": "CSS code to be injected."},
              "file": {"type": "string", "optional": true, "description": "CSS file to be injected."},
              "allFrames": {"type": "boolean", "optional": true, "description": "If allFrames is true, this function injects CSS text into all frames of current page. By default, it's false and CSS is injected only into the top main frame."}
            }
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "description": "Called when all the CSS has been inserted.",
          "parameters": []
        }
      }
    ],
    "events": [
      {
        "name": "onCreated",
        "type": "function",
        "description": "Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.",
        "parameters": [
          {
            "$ref": "Tab",
            "name": "tab",
            "description": "Details of the tab that was created."
          }
        ]
      },
      {
        "name": "onUpdated",
        "type": "function",
        "description": "Fired when a tab is updated.",
        "parameters": [
          {"type": "integer", "name": "tabId", "minimum": 0},
          {
            "type": "object",
            "name": "changeInfo",
            "description": "Lists the changes to the state of the tab that was updated.",
            "properties": {
              "status": {
                "type": "string",
                "optional": true,
                "description": "The status of the tab. Can be either <em>loading</em> or <em>complete</em>."
              },
              "url": {
                "type": "string",
                "optional": true,
                "description": "The tab's URL if it has changed."
              },
              "pinned": {
                "type": "boolean",
                "optional": true,
                "description": "The tab's new pinned state."
              }
            }
          },
          {
            "$ref": "Tab",
            "name": "tab",
            "description": "Gives the state of the tab that was updated."
          }
        ]
      },
      {
        "name": "onMoved",
        "type": "function",
        "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see <a href='#event-onDetached'>onDetached</a>.",
        "parameters": [
          {"type": "integer", "name": "tabId", "minimum": 0},
          {
            "type": "object",
            "name": "moveInfo",
            "properties": {
              "windowId": {"type": "integer", "minimum": 0},
              "fromIndex": {"type": "integer", "minimum": 0},
              "toIndex": {"type": "integer", "minimum": 0}
            }
          }
        ]
      },
      {
        "name": "onSelectionChanged",
        "nodoc": true,
        "type": "function",
        "description": "Deprecated. Please use onActiveChanged.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0,
            "description": "The ID of the tab that has become active."
          },
          {
            "type": "object",
            "name": "selectInfo",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": 0,
                "description": "The ID of the window the selected tab changed inside of."
              }
            }
          }
        ]
      },
      {
        "name": "onActiveChanged",
        "type": "function",
        "description": "Fires when the selected tab in a window changes.",
        "parameters": [
          {
            "type": "integer",
            "name": "tabId",
            "minimum": 0,
            "description": "The ID of the tab that has become active."
          },
          {
            "type": "object",
            "name": "selectInfo",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": 0,
                "description": "The ID of the window the selected tab changed inside of."
              }
            }
          }
        ]
      },
      {
        "name": "onHighlightChanged",
        "type": "function",
        "description": "Fired when the highlighted or selected tabs in a window changes.",
        "parameters": [
          {
            "type": "object",
            "name": "selectInfo",
            "properties": {
              "windowId": {
                "type": "integer",
                "minimum": 0,
                "description": "The window whose tabs changed."
              },
              "tabIds": {
                "type": "array",
                "name": "tabIds",
                "items": {"type": "integer", "minimum": 0},
                "description": "All highlighted tabs in the window."
              }
            }
          }
        ]
      },
      {
        "name": "onDetached",
        "type": "function",
        "description": "Fired when a tab is detached from a window, for example because it is being moved between windows.",
        "parameters": [
          {"type": "integer", "name": "tabId", "minimum": 0},
          {
            "type": "object",
            "name": "detachInfo",
            "properties": {
              "oldWindowId": {"type": "integer", "minimum": 0},
              "oldPosition": {"type": "integer", "minimum": 0}
            }
          }
        ]
      },
      {
        "name": "onAttached",
        "type": "function",
        "description": "Fired when a tab is attached to a window, for example because it was moved between windows.",
        "parameters": [
          {"type": "integer", "name": "tabId", "minimum": 0},
          {
            "type": "object",
            "name": "attachInfo",
            "properties": {
              "newWindowId": {"type": "integer", "minimum": 0},
              "newPosition": {"type": "integer", "minimum": 0}
            }
          }
        ]
      },
      {
        "name": "onRemoved",
        "type": "function",
        "description": "Fired when a tab is closed. Note: A listener can be registered for this event without requesting the 'tabs' permission in the manifest.",
        "parameters": [
          {"type": "integer", "name": "tabId", "minimum": 0},
          {
            "type": "object",
            "name": "removeInfo",
            "properties": {
              "isWindowClosing": {"type": "boolean", "description": "True when the tab is being closed because its window is being closed." }
            }
          }
        ]
      }
    ]
  }
]