From 7cf364b0293faca34e3384eef3aeda6e53df8038 Mon Sep 17 00:00:00 2001 From: "rafaelw@chromium.org" Date: Fri, 7 Aug 2009 00:46:08 +0000 Subject: Buff out Windows & Tabs API, fix a few doc bugs. This adds callback types, event types, and descriptions for the tabs & windows api. All defined types are loaded first in preparing the template data, so that types can cross reference across apis. Also, additional commentary is added to content_scripts.html doc about communication with the embedding page of a content_script. A check is now made in build.py for the case of the doc page rendering timing out (which is typically a clue that page rendering went wrong and should be inspected with chrome). Review URL: http://codereview.chromium.org/165063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22706 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/common_resources.grd | 2 +- chrome/common/extensions/api/extension_api.json | 106 +++++++++++++++++---- chrome/common/extensions/docs/build/build.bat | 7 ++ chrome/common/extensions/docs/build/build.py | 12 ++- chrome/common/extensions/docs/content_scripts.html | 2 +- .../extensions/docs/js/api_page_generator.js | 18 ++-- .../extensions/docs/static/content_scripts.html | 30 +++++- chrome/common/extensions/docs/tabs.html | 2 +- chrome/common/extensions/docs/windows.html | 2 +- 9 files changed, 146 insertions(+), 35 deletions(-) create mode 100755 chrome/common/extensions/docs/build/build.bat diff --git a/chrome/common/common_resources.grd b/chrome/common/common_resources.grd index 5e90f50..5ea8f3c 100644 --- a/chrome/common/common_resources.grd +++ b/chrome/common/common_resources.grd @@ -1,6 +1,6 @@ +without changes to the corresponding grd file. rw --> diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index d31291c..501c62e 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -2,10 +2,6 @@ { "namespace": "self", "types": [ - { - "id": "HTMLWindow", - "type": "object" - } ], "functions": [ { @@ -16,7 +12,7 @@ "returns": { "type": "array", "description": "Array of HTMLWindow objects", - "items": { "$ref": "HTMLWindow" } + "items": { "type": "object" } } } ], @@ -24,46 +20,92 @@ }, { "namespace": "windows", - "types": [], + "types": [ + { + "id": "Window", + "type": "object", + "properties": { + "id": {"type": "integer", "minimum": 0}, + "focused": {"type": "boolean"}, + "left": {"type": "integer"}, + "top": {"type": "integer"}, + "bottom": {"type": "integer"}, + "right": {"type": "integer"}, + "tabs": {"type": "array", "items": { "$ref": "Tab" }, "optional": true} + } + } + ], "functions": [ { "name": "get", "type": "function", - "description": "", + "description": "Get window with given id.", "parameters": [ {"type": "integer", "name": "windowId", "minimum": 0}, - {"type": "function", "name": "callback"} + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", "$ref": "Window" + } + ] + } ] }, { "name": "getCurrent", "type": "function", - "description": "", + "description": "Get the window that is the container for the caller. i.e. the window containing the ToolStrip that makes the call.", "parameters": [ - {"type": "function", "name": "callback"} + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", "$ref": "Window" + } + ] + } ] }, { "name": "getLastFocused", "type": "function", - "description": "", + "description": "Get the window that was most recenly focused -- typically the window 'on top'.", "parameters": [ - {"type": "function", "name": "callback"} + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", "$ref": "Window" + } + ] + } ] }, { "name": "getAll", "type": "function", - "description": "", + "description": "Get all windows. If populate is true, each window object will have a tabs property that contains a list of the Tab objects for that window.", "parameters": [ {"type": "boolean", "name": "populate", "optional": true}, - {"type": "function", "name": "callback"} + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "windows", "type": "array", "items": { "type": "object" } + } + ] + } ] }, { "name": "create", "type": "function", - "description": "", + "description": "Create (open) a new browser with any optional sizing, position or default url provided.", "parameters": [ { "type": "object", @@ -77,7 +119,16 @@ }, "optional": true }, - {"type": "function", "name": "callback", "optional": true} + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", "$ref": "Window" + } + ] + } ] }, { @@ -96,7 +147,16 @@ "height": {"type": "integer", "minimum": 0, "optional": true} } }, - {"type": "function", "name": "callback", "optional": true} + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", "$ref": "Window" + } + ] + } ] }, { @@ -105,7 +165,7 @@ "description": "", "parameters": [ {"type": "integer", "name": "windowId", "minimum": 0}, - {"type": "function", "name": "callback", "optional": true} + {"type": "function", "name": "callback", "optional": true, "parameters": []} ] } ], @@ -212,7 +272,13 @@ "description": "", "parameters": [ {"type": "integer", "name": "windowId", "minimum": 0, "optional": true}, - {"type": "function", "name": "callback"} + { + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tabs", "type": "array", "items": { "$ref": "Tab" } } + ] + } ] }, { @@ -453,7 +519,7 @@ "parameters": [ { "name": "idOrIdList", - "choice": [ + "choices": [ {"type": "string"}, {"type": "array", "items": {"type": "string"}, "minItems": 1} ] diff --git a/chrome/common/extensions/docs/build/build.bat b/chrome/common/extensions/docs/build/build.bat new file mode 100755 index 0000000..fd81d47 --- /dev/null +++ b/chrome/common/extensions/docs/build/build.bat @@ -0,0 +1,7 @@ +@echo off + +:: Runs the win32 python interpreter checked into third_party\python_24 on +:: windows. cygwin python will not work because it will path /cygdrive/... +:: paths to test_shell. + +..\..\..\..\..\third_party\python_24\python.exe build.py \ No newline at end of file diff --git a/chrome/common/extensions/docs/build/build.py b/chrome/common/extensions/docs/build/build.py index be822f9..de2c891 100755 --- a/chrome/common/extensions/docs/build/build.py +++ b/chrome/common/extensions/docs/build/build.py @@ -59,7 +59,7 @@ def RenderPage(name, test_shell): stdout=PIPE) # first output line is url that was processed by test_shell - p.stdout.readline() + firstline = p.stdout.readline() # second output line is the layoutTestShell.dumpText() value. result = p.stdout.readline() @@ -68,8 +68,14 @@ def RenderPage(name, test_shell): os.remove(input_file) if (not result.startswith(_expected_output_preamble)): - if (original): - open(input_file).write(original); + if (firstline.startswith("#TEST_TIMED_OUT")): + raise Exception("test_shell returned TEST_TIMED_OUT.\n" + + "Their was probably a problem with generating the " + + "page\n" + + "Try copying template/page_shell.html to:\n" + + input_file + + "\nAnd open it in chrome using the file: scheme.\n" + + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result); # Write output diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html index 9ff4f28..472acc9 100755 --- a/chrome/common/extensions/docs/content_scripts.html +++ b/chrome/common/extensions/docs/content_scripts.html @@ -1 +1 @@ - content_scripts

Content Scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them.

Some examples of things that content scripts can do include:

  • Find unlinked URLs in web pages and convert them into hyperlinks
  • Increase the font size to make text more legible
  • Find and process microformat data in the DOM

Registration

Content scripts are registered in an extension's manifest.json file, like so:

{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.",  "content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["mystyles.css"], "js": ["jquery.js", "myscript.js"] } ] }

An extension can contain any number of content scripts, and a content script can consist of any number of JavaScript or CSS files. The value of the matches property controls when the content script will run.

Each content script registered in the manifest can specify the following properties:

Name Type Description
matches array of strings Required. Controls the pages this content script will be injected into. See Match Patterns for more details on the syntax of these strins.
js array of strings Optional. The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.
css array of strings Optional. The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.
run_at string Optional. Controls when the files in js are injected. Can be "document_start" or "document_end". Defaults to "document_end". In the case of "document_start", the files are injected after any files from "css", but before any other DOM is constructed or any other script is run. In the case of "document_end", the files are injected after the DOM is complete, but before subresources like images and frames have necessarily loaded.

Match Patterns

TODO

Execution Environment

Content scripts execute in a special environment called an isolated world. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. It looks to each content script as if there is no other JavaScript executing on the page it is running on. The same is true in reverse: JavaScript running on the page cannot call any functions or access any variables defined by content scripts.

For example, consider this simple page:

hello.html =========== <html> <button id="button">click me</button> <script> var greeting = "hello!"; function sayGreeting() { alert(greeting); } document.getElementById("button").onclick = sayGreeting; </script> </html>

Now, suppose this content script was injected into hello.html:

contentscript.js ================== console.log(greeting); // undefined console.log(sayGreeting); // undefined console.log(document.getElementById("button").onclick); // still undefined document.getElementById("button").onclick = function() { alert("hola!"); }

Now, if the button is pressed, you will see both greetings.

Isolated worlds allow each content script to make changes to its JavaScript environment without worrying about conflicting with the page or with other contnet scripts. For example, a content script could include JQuery v1 and the page could include JQuery v2, and they wouldn't conflict with each other.

Another important benefit of isolated worlds is that they completely separate the JavaScript on the page from the JavaScript in extensions. This allows us to offer extra functionality to content scripts that should not be accessible from web pages without worrying about web pages accessing it.

Messaging

Content scripts can communicate with their parent extension using message passing. The content script opens a channel to the extension using the chrome.extension.connect() method and then sends messages back and forth to it. The messages can contain any valid JSON object (null, boolean, number, string, array, or object).

The parent extension can also open a channel to a content script in a given tab by calling chrome.tabs.connect(tabId).

When a channel is opened from a content script to an extension, the onConnect event is fired in all views in the extension. Any view can receive the event. The event contains a Port object, which can be used by the extension view to communicate back to the content script.

[TODO: Complete this]

+ content_scripts

Content Scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them.

Some examples of things that content scripts can do include:

  • Find unlinked URLs in web pages and convert them into hyperlinks
  • Increase the font size to make text more legible
  • Find and process microformat data in the DOM

Registration

Content scripts are registered in an extension's manifest.json file, like so:

{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.",  "content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["mystyles.css"], "js": ["jquery.js", "myscript.js"] } ] }

An extension can contain any number of content scripts, and a content script can consist of any number of JavaScript or CSS files. The value of the matches property controls when the content script will run.

Each content script registered in the manifest can specify the following properties:

Name Type Description
matches array of strings Required. Controls the pages this content script will be injected into. See Match Patterns for more details on the syntax of these strins.
js array of strings Optional. The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.
css array of strings Optional. The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.
run_at string Optional. Controls when the files in js are injected. Can be "document_start" or "document_end". Defaults to "document_end". In the case of "document_start", the files are injected after any files from "css", but before any other DOM is constructed or any other script is run. In the case of "document_end", the files are injected after the DOM is complete, but before subresources like images and frames have necessarily loaded.

Match Patterns

TODO

Execution Environment

Content scripts execute in a special environment called an isolated world. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. It looks to each content script as if there is no other JavaScript executing on the page it is running on. The same is true in reverse: JavaScript running on the page cannot call any functions or access any variables defined by content scripts.

For example, consider this simple page:

hello.html =========== <html> <button id="button">click me</button> <script> var greeting = "hello!"; function sayGreeting() { alert(greeting); } document.getElementById("button").onclick = sayGreeting; </script> </html>

Now, suppose this content script was injected into hello.html:

contentscript.js ================== console.log(greeting); // undefined console.log(sayGreeting); // undefined console.log(document.getElementById("button").onclick); // still undefined document.getElementById("button").onclick = function() { alert("hola!"); }

Now, if the button is pressed, you will see both greetings.

Isolated worlds allow each content script to make changes to its JavaScript environment without worrying about conflicting with the page or with other contnet scripts. For example, a content script could include JQuery v1 and the page could include JQuery v2, and they wouldn't conflict with each other.

Another important benefit of isolated worlds is that they completely separate the JavaScript on the page from the JavaScript in extensions. This allows us to offer extra functionality to content scripts that should not be accessible from web pages without worrying about web pages accessing it.

Messaging

Content scripts can communicate with their parent extension using message passing. The content script opens a channel to the extension using the chrome.extension.connect() method and then sends messages back and forth to it. The messages can contain any valid JSON object (null, boolean, number, string, array, or object).

The parent extension can also open a channel to a content script in a given tab by calling chrome.tabs.connect(tabId).

When a channel is opened from a content script to an extension, the onConnect event is fired in all views in the extension. Any view can receive the event. The event contains a Port object, which can be used by the extension view to communicate back to the content script.

[TODO: Complete this]

Communication with the embedding page

Although the execution environments of content scripts and the pages that host them are isolated from each other, they share access to the page's DOM. If the page wishes to communicate with the content script (or with the extension via the content script), it must do so through the shared DOM.

An example can be accomplished using custom DOM events and storing data in a known location. Consider:

http://foo.com/example.html ================================ var customEvent = document.createEvent('Event'); customEvent.initEvent('myCustomEvent', true, true); function fireCustomEvent(data) { hidenDiv = document.getElementById('myCustomEventDiv'); hidenDiv.innerHTML = data hidenDiv.dispatchEvent(customEvent); }
contentscript.js ===================== var port = chrome.extension.connect(); document.getElementById('myCustomEventDiv').addEventListener('myCustomEvent', function() { var eventData = document.getElementById('myCustomEventDiv').innerHTML; port.postMessage({message: "myCustomEvent", values: eventData}); });

In the above example, example.html (which is not a part of the extension) creates a custom event and then can decide to fire the event by setting the event data to a known location in the DOM and then dispatching the custom event. The content script listens for the name of the custom event on the known element and handles the event by inspecting the data of the element, and turning around to post the message to the extension process. In this way the page establishes a line of communication to the extension. The reverse is possible through similar means.

diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js index 4613d75..0d30c90 100755 --- a/chrome/common/extensions/docs/js/api_page_generator.js +++ b/chrome/common/extensions/docs/js/api_page_generator.js @@ -140,14 +140,18 @@ function renderTemplate(schemaContent) { pageData = {}; var schema = JSON.parse(schemaContent); + // Find all defined types + schema.each(function(module) { + if (module.types) { + module.types.each(function(t) { + types[t.id] = t; + }); + } + }); + schema.each(function(module) { if (module.namespace == pageName) { // This page is an api page. Setup types and apiDefinition. - if (module.types) { - module.types.each(function(t) { - types[t.id] = t; - }); - } pageData.apiDefinition = module; preprocessApi(pageData, schema); } @@ -288,9 +292,9 @@ function typeName(schema) { if (schema.$ref) schema = types[schema.$ref]; - if (schema.choice) { + if (schema.choices) { var typeNames = []; - schema.choice.each(function(c) { + schema.choices.each(function(c) { typeNames.push(typeName(c)); }); diff --git a/chrome/common/extensions/docs/static/content_scripts.html b/chrome/common/extensions/docs/static/content_scripts.html index d380348..0f8b3bb 100644 --- a/chrome/common/extensions/docs/static/content_scripts.html +++ b/chrome/common/extensions/docs/static/content_scripts.html @@ -105,4 +105,32 @@ document.getElementById("button").onclick = function() {

When a channel is opened from a content script to an extension, the onConnect event is fired in all views in the extension. Any view can receive the event. The event contains a Port object, which can be used by the extension view to communicate back to the content script. -

[TODO: Complete this] \ No newline at end of file +

[TODO: Complete this] + +

Communication with the embedding page

+ +

Although the execution environments of content scripts and the pages that host them are isolated from each other, they share access to the page's DOM. If the page wishes to communicate with the content script (or with the extension via the content script), it must do so through the shared DOM.

+ +

An example can be accomplished using custom DOM events and storing data in a known location. Consider:

+ +
http://foo.com/example.html
+================================
+var customEvent = document.createEvent('Event');
+customEvent.initEvent('myCustomEvent', true, true);
+
+function fireCustomEvent(data) {
+  hidenDiv = document.getElementById('myCustomEventDiv');
+  hidenDiv.innerHTML = data
+  hidenDiv.dispatchEvent(customEvent);
+}
+ +
contentscript.js
+=====================
+var port = chrome.extension.connect();
+
+document.getElementById('myCustomEventDiv').addEventListener('myCustomEvent', function() {
+  var eventData = document.getElementById('myCustomEventDiv').innerHTML;
+  port.postMessage({message: "myCustomEvent", values: eventData});
+});
+ +

In the above example, example.html (which is not a part of the extension) creates a custom event and then can decide to fire the event by setting the event data to a known location in the DOM and then dispatching the custom event. The content script listens for the name of the custom event on the known element and handles the event by inspecting the data of the element, and turning around to post the message to the extension process. In this way the page establishes a line of communication to the extension. The reverse is possible through similar means.

diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index a14315f..affef83 100755 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -1 +1 @@ - chrome.tabs API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. connect
    3. getSelected
    4. getAllInWindow
    5. create
    6. update
    7. move
    8. remove
    9. detectLanguage
  3. Events
    1. onCreated
    2. onUpdated
    3. onMoved
    4. onSelectionChanged
    5. onAttached
    6. onDetached
    7. onRemoved
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.tabs.get(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

connect

object chrome.tabs.connect(, integer tabId, string name)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
name (optional string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

Port (object)
Undocumented.
Description of this parameter from the json schema.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getSelected

void chrome.tabs.getSelected(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

getAllInWindow

void chrome.tabs.getAllInWindow(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.tabs.create(, object CreateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

CreateProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.tabs.update(, integer tabId, object UpdateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateProperties (object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

move

void chrome.tabs.move(, integer tabId, object MoveProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.tabs.remove(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

detectLanguage

void chrome.tabs.detectLanguage(, integer tabId, function callback)

detect language of tab.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(string language) {...});
language (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(object tab) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

onUpdated

chrome.bookmarks.onUpdated.addListener(function(integer tabId, object ChangedProps) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangedProps (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
status (string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.

onMoved

chrome.bookmarks.onMoved.addListener(function(integer tabId, object MoveInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
fromIndex (integer)
Undocumented.
Description of this parameter from the json schema.
toIndex (integer)
Undocumented.
Description of this parameter from the json schema.

onSelectionChanged

chrome.bookmarks.onSelectionChanged.addListener(function(integer tabId, object SelectInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
SelectInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.

onAttached

chrome.bookmarks.onAttached.addListener(function(integer tabId, object AttachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
AttachInfo (object)
Undocumented.
Description of this parameter from the json schema.
newWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
newPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onDetached

chrome.bookmarks.onDetached.addListener(function(integer tabId, object DetachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
DetachInfo (object)
Undocumented.
Description of this parameter from the json schema.
oldWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
oldPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer tabId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
+ chrome.tabs API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. connect
    3. getSelected
    4. getAllInWindow
    5. create
    6. update
    7. move
    8. remove
    9. detectLanguage
  3. Events
    1. onCreated
    2. onUpdated
    3. onMoved
    4. onSelectionChanged
    5. onAttached
    6. onDetached
    7. onRemoved
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.tabs.get(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

connect

object chrome.tabs.connect(, integer tabId, string name)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
name (optional string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

Port (object)
Undocumented.
Description of this parameter from the json schema.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getSelected

void chrome.tabs.getSelected(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

getAllInWindow

void chrome.tabs.getAllInWindow(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(array of object tabs) {...});
tabs (array of object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.tabs.create(, object CreateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

CreateProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.tabs.update(, integer tabId, object UpdateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateProperties (object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

move

void chrome.tabs.move(, integer tabId, object MoveProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.tabs.remove(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

detectLanguage

void chrome.tabs.detectLanguage(, integer tabId, function callback)

detect language of tab.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(string language) {...});
language (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(object tab) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

onUpdated

chrome.bookmarks.onUpdated.addListener(function(integer tabId, object ChangedProps) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangedProps (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
status (string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.

onMoved

chrome.bookmarks.onMoved.addListener(function(integer tabId, object MoveInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
fromIndex (integer)
Undocumented.
Description of this parameter from the json schema.
toIndex (integer)
Undocumented.
Description of this parameter from the json schema.

onSelectionChanged

chrome.bookmarks.onSelectionChanged.addListener(function(integer tabId, object SelectInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
SelectInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.

onAttached

chrome.bookmarks.onAttached.addListener(function(integer tabId, object AttachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
AttachInfo (object)
Undocumented.
Description of this parameter from the json schema.
newWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
newPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onDetached

chrome.bookmarks.onDetached.addListener(function(integer tabId, object DetachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
DetachInfo (object)
Undocumented.
Description of this parameter from the json schema.
oldWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
oldPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer tabId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index 2bd300b..093282a 100755 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -1 +1 @@ - chrome.windows API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getCurrent
    3. getLastFocused
    4. getAll
    5. create
    6. update
    7. remove
  3. Events
    1. onCreated
    2. onRemoved
    3. onFocusChanged
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.windows.get(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getCurrent

void chrome.windows.getCurrent(, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getLastFocused

void chrome.windows.getLastFocused(, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getAll

void chrome.windows.getAll(, boolean populate, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

populate (optional boolean)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.windows.create(, object CreateData, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

CreateData (optional object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.windows.update(, integer windowId, object UpdateInfo, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateInfo (object)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.windows.remove(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onFocusChanged

chrome.bookmarks.onFocusChanged.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
+ chrome.windows API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getCurrent
    3. getLastFocused
    4. getAll
    5. create
    6. update
    7. remove
  3. Events
    1. onCreated
    2. onRemoved
    3. onFocusChanged
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.windows.get(, integer windowId, function callback)

Get window with given id.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object window) {...});
window (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
focused (boolean)
Undocumented.
Description of this parameter from the json schema.
left (integer)
Undocumented.
Description of this parameter from the json schema.
top (integer)
Undocumented.
Description of this parameter from the json schema.
bottom (integer)
Undocumented.
Description of this parameter from the json schema.
right (integer)
Undocumented.
Description of this parameter from the json schema.
tabs (optional array of object)
Undocumented.
Description of this parameter from the json schema.

getCurrent

void chrome.windows.getCurrent(, function callback)

Get the window that is the container for the caller. i.e. the window containing the ToolStrip that makes the call.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object window) {...});
window (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
focused (boolean)
Undocumented.
Description of this parameter from the json schema.
left (integer)
Undocumented.
Description of this parameter from the json schema.
top (integer)
Undocumented.
Description of this parameter from the json schema.
bottom (integer)
Undocumented.
Description of this parameter from the json schema.
right (integer)
Undocumented.
Description of this parameter from the json schema.
tabs (optional array of object)
Undocumented.
Description of this parameter from the json schema.

getLastFocused

void chrome.windows.getLastFocused(, function callback)

Get the window that was most recenly focused -- typically the window 'on top'.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object window) {...});
window (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
focused (boolean)
Undocumented.
Description of this parameter from the json schema.
left (integer)
Undocumented.
Description of this parameter from the json schema.
top (integer)
Undocumented.
Description of this parameter from the json schema.
bottom (integer)
Undocumented.
Description of this parameter from the json schema.
right (integer)
Undocumented.
Description of this parameter from the json schema.
tabs (optional array of object)
Undocumented.
Description of this parameter from the json schema.

getAll

void chrome.windows.getAll(, boolean populate, function callback)

Get all windows. If populate is true, each window object will have a tabs property that contains a list of the Tab objects for that window.

Parameters

populate (optional boolean)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(array of object windows) {...});
windows (array of object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.windows.create(, object CreateData, function callback)

Create (open) a new browser with any optional sizing, position or default url provided.

Parameters

CreateData (optional object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object window) {...});
window (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
focused (boolean)
Undocumented.
Description of this parameter from the json schema.
left (integer)
Undocumented.
Description of this parameter from the json schema.
top (integer)
Undocumented.
Description of this parameter from the json schema.
bottom (integer)
Undocumented.
Description of this parameter from the json schema.
right (integer)
Undocumented.
Description of this parameter from the json schema.
tabs (optional array of object)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.windows.update(, integer windowId, object UpdateInfo, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateInfo (object)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object window) {...});
window (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
focused (boolean)
Undocumented.
Description of this parameter from the json schema.
left (integer)
Undocumented.
Description of this parameter from the json schema.
top (integer)
Undocumented.
Description of this parameter from the json schema.
bottom (integer)
Undocumented.
Description of this parameter from the json schema.
right (integer)
Undocumented.
Description of this parameter from the json schema.
tabs (optional array of object)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.windows.remove(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onFocusChanged

chrome.bookmarks.onFocusChanged.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
-- cgit v1.1