From 4eddcddf2737503c440bbdef106f5a6436d71670 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Fri, 14 Aug 2009 08:08:40 +0000 Subject: Update chrome.extension docs. Also, remove old no longer needed chrome.self page and replace missing bookmarks entries in left nav. TBR=rafaelw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23428 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/extensions/docs/api_index.html | 2 +- chrome/common/extensions/docs/background_pages.html | 2 +- chrome/common/extensions/docs/bookmarks.html | 2 +- chrome/common/extensions/docs/content_scripts.html | 2 +- chrome/common/extensions/docs/devguide.html | 2 +- chrome/common/extensions/docs/extension.html | 2 +- chrome/common/extensions/docs/getstarted.html | 2 +- chrome/common/extensions/docs/index.html | 2 +- chrome/common/extensions/docs/manifest.html | 2 +- chrome/common/extensions/docs/overview.html | 2 +- chrome/common/extensions/docs/packaging.html | 2 +- chrome/common/extensions/docs/pageActions.html | 2 +- chrome/common/extensions/docs/self.html | 1 - chrome/common/extensions/docs/static/self.html | 5 ----- chrome/common/extensions/docs/tabs.html | 2 +- chrome/common/extensions/docs/template/api_template.html | 4 ++-- chrome/common/extensions/docs/tool_strips.html | 1 - chrome/common/extensions/docs/toolstrip.html | 2 +- chrome/common/extensions/docs/windows.html | 2 +- 19 files changed, 17 insertions(+), 24 deletions(-) delete mode 100755 chrome/common/extensions/docs/self.html delete mode 100755 chrome/common/extensions/docs/static/self.html delete mode 100755 chrome/common/extensions/docs/tool_strips.html diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html index 4b7d3b2..1ed69b4 100755 --- a/chrome/common/extensions/docs/api_index.html +++ b/chrome/common/extensions/docs/api_index.html @@ -1 +1 @@ - [object HTMLDivElement]

[PENDING: links to reference doc — for example, chrome.* APIs — go here.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

+ [object HTMLDivElement]

[PENDING: links to reference doc — for example, chrome.* APIs — go here.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

diff --git a/chrome/common/extensions/docs/background_pages.html b/chrome/common/extensions/docs/background_pages.html index 0171b93..50d7f94 100755 --- a/chrome/common/extensions/docs/background_pages.html +++ b/chrome/common/extensions/docs/background_pages.html @@ -1 +1 @@ - [object HTMLDivElement]
Background Pages

A common need for extensions is to have a single long-running script to manage some task or state. Toolstrips don't quite fit this need, because there can be multiple toolstrips active at any one time (one per browser window). Background pages to the rescue.

The background page is similar to a toolstrip, in that it is an HTML page that runs in the extension process. The difference is that the background page exists for the lifetime of your extension, and there is only one instance of it active at a time.

Status

Implemented.

Details

Register your background page in the extension manifest, like this:

{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "background_page": "background.html", "toolstrips": ["toolstrip.html"] }

Your toolstrip will likely contain only the necessary code to display the toolstrip UI, with all your extension logic contained in the background page. You can communicate between your various pages using direct script calls, similar to how frames can communicate. The chrome.self.getViews() function returns a list of window objects for every active page belonging to your extension.

Example

background_page.html (snippet): function updateUI(checked) { var views = chrome.self.getViews(); for (var i in views) { if (views[i].enableCheckbox) views[i].enableCheckbox(checked); } } toolstrip.html (snippet): function enableCheckbox(checked) { var elm = document.getElementById('checkbox'); elm.checked = checked; }
+ [object HTMLDivElement]
Background Pages

A common need for extensions is to have a single long-running script to manage some task or state. Toolstrips don't quite fit this need, because there can be multiple toolstrips active at any one time (one per browser window). Background pages to the rescue.

The background page is similar to a toolstrip, in that it is an HTML page that runs in the extension process. The difference is that the background page exists for the lifetime of your extension, and there is only one instance of it active at a time.

Status

Implemented.

Details

Register your background page in the extension manifest, like this:

{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "background_page": "background.html", "toolstrips": ["toolstrip.html"] }

Your toolstrip will likely contain only the necessary code to display the toolstrip UI, with all your extension logic contained in the background page. You can communicate between your various pages using direct script calls, similar to how frames can communicate. The chrome.self.getViews() function returns a list of window objects for every active page belonging to your extension.

Example

background_page.html (snippet): function updateUI(checked) { var views = chrome.self.getViews(); for (var i in views) { if (views[i].enableCheckbox) views[i].enableCheckbox(checked); } } toolstrip.html (snippet): function enableCheckbox(checked) { var elm = document.getElementById('checkbox'); elm.checked = checked; }
diff --git a/chrome/common/extensions/docs/bookmarks.html b/chrome/common/extensions/docs/bookmarks.html index b807f81..6e72b57 100755 --- a/chrome/common/extensions/docs/bookmarks.html +++ b/chrome/common/extensions/docs/bookmarks.html @@ -1 +1 @@ - [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getChildren
    3. getTree
    4. search
    5. create
    6. move
    7. update
    8. remove
    9. removeTree
  3. Events
    1. onAdded
    2. onRemoved
    3. onChanged
    4. onMoved
    5. onChildrenReordered
  4. Types
    1. BookmarkTreeNode
[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?]

Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks.

Description

[PENDING: intro goes here...]

Bookmark objects are an important part of the chrome.bookmarks API. Each bookmark object represents either a URL or a group of bookmarks, as you can see in the following figure.

2 kinds of bookmark objects

Properties

Objects that represent bookmarks can have the following properties:

id
An integer ID that's unique for each bookmark. Don't save this ID in persistent storage; the ID for a particular bookmark might change the next time the browser is started.
title
The name of the bookmark. This is the user-visible string that describes the URL or group.
parentId (omitted for the root group)
The ID of the group that this bookmark is in.
index (optional; omitted for the root group)
The 0-based integer position of the bookmark within its group.
url (omitted for groups)
The URL of the page that the bookmark points to.

Examples

The following code creates a bookmark group with the title "Chromium bookmarks". The last argument defines a function to be executed after the folder is created.

chrome.bookmarks.create({'parentId': bookmarkBar.id, 'title': 'Chromium bookmarks'}, function(newFolder) {...}); 

The next snippet creates a bookmark pointing to the Chromium developer doc. Since nothing too bad will happen if creating the bookmark fails, this snippet doesn't bother to define a callback function.

chrome.bookmarks.create({'parentId': chromiumBookmarks.id, 'title': 'dev doc', 'url': 'http://dev.chromium.org'}); 

Say you have bookmark hierarchy that looks like this:

  • Bookmarks
    • Google
      • Apps
        • ...
        • ...
        • ...
      • Google homepage
    • Example

Here's how those bookmarks might be represented with bookmark objects:

a hierarchy of bookmarks

Here's some code you could use to create that hierarchy:

...code goes here... 

Methods

get

void chrome.bookmarks.get(, string or array of string idOrIdList, function callback)

Retrieves the specified BookmarkTreeNode(s).

Parameters

idOrIdList
( Type array of string or array of string )
A single string-valued id, or an array of string-valued ids
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

getChildren

void chrome.bookmarks.getChildren(, string id, function callback)

Retrieves the children of the specified BookmarkTreeNode id.

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

getTree

void chrome.bookmarks.getTree(, function callback)

Retrieves the entire Bookmarks hierarchy.

Parameters

callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

search

void chrome.bookmarks.search(, string query, function callback)

Seaches for BookmarkTreeNodes matching the given query.

Parameters

query
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

create

void chrome.bookmarks.create(, object bookmark, function callback)

Undocumented.

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

Parameters

bookmark
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
parentId
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( optional Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
url
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(BookmarkTreeNode result) {...});
result
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

move

void chrome.bookmarks.move(, string id, object destination, function callback)

Moves the specified BookmarkTreeNode to the provided location.

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
destination
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
parentId
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( optional Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

update

void chrome.bookmarks.update(, string id, object changes, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
changes
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(BookmarkTreeNode result) {...});
result
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

remove

void chrome.bookmarks.remove(, string id, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

removeTree

void chrome.bookmarks.removeTree(, string id, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

Events

onAdded

chrome.bookmarks.onAdded.addListener(function(string id, BookmarkTreeNode bookmark) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
bookmark
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

onRemoved

chrome.bookmarks.onRemoved.addListener(function(string id, object removeInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
removeInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
parentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids

onChanged

chrome.bookmarks.onChanged.addListener(function(string id, object changeInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
changeInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids

onMoved

chrome.bookmarks.onMoved.addListener(function(string id, object moveInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
moveInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
parentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
oldParentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
oldIndex
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids

onChildrenReordered

chrome.bookmarks.onChildrenReordered.addListener(function(string id, arary childIds) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
childIds
( Type array of arary )
Undocumented.
A single string-valued id, or an array of string-valued ids

Types

BookmarkTreeNode

idOrIdList
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
id
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
windowId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
selected
( Type array of boolean )
Undocumented.
A single string-valued id, or an array of string-valued ids
url
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
favIconUrl
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
+ [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getChildren
    3. getTree
    4. search
    5. create
    6. move
    7. update
    8. remove
    9. removeTree
  3. Events
    1. onAdded
    2. onRemoved
    3. onChanged
    4. onMoved
    5. onChildrenReordered
  4. Types
    1. BookmarkTreeNode
[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?]

Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks.

Description

[PENDING: intro goes here...]

Bookmark objects are an important part of the chrome.bookmarks API. Each bookmark object represents either a URL or a group of bookmarks, as you can see in the following figure.

2 kinds of bookmark objects

Properties

Objects that represent bookmarks can have the following properties:

id
An integer ID that's unique for each bookmark. Don't save this ID in persistent storage; the ID for a particular bookmark might change the next time the browser is started.
title
The name of the bookmark. This is the user-visible string that describes the URL or group.
parentId (omitted for the root group)
The ID of the group that this bookmark is in.
index (optional; omitted for the root group)
The 0-based integer position of the bookmark within its group.
url (omitted for groups)
The URL of the page that the bookmark points to.

Examples

The following code creates a bookmark group with the title "Chromium bookmarks". The last argument defines a function to be executed after the folder is created.

chrome.bookmarks.create({'parentId': bookmarkBar.id, 'title': 'Chromium bookmarks'}, function(newFolder) {...}); 

The next snippet creates a bookmark pointing to the Chromium developer doc. Since nothing too bad will happen if creating the bookmark fails, this snippet doesn't bother to define a callback function.

chrome.bookmarks.create({'parentId': chromiumBookmarks.id, 'title': 'dev doc', 'url': 'http://dev.chromium.org'}); 

Say you have bookmark hierarchy that looks like this:

  • Bookmarks
    • Google
      • Apps
        • ...
        • ...
        • ...
      • Google homepage
    • Example

Here's how those bookmarks might be represented with bookmark objects:

a hierarchy of bookmarks

Here's some code you could use to create that hierarchy:

...code goes here... 

Methods

get

void chrome.bookmarks.get(, string or array of string idOrIdList, function callback)

Retrieves the specified BookmarkTreeNode(s).

Parameters

idOrIdList
( Type array of string or array of string )
A single string-valued id, or an array of string-valued ids
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

getChildren

void chrome.bookmarks.getChildren(, string id, function callback)

Retrieves the children of the specified BookmarkTreeNode id.

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

getTree

void chrome.bookmarks.getTree(, function callback)

Retrieves the entire Bookmarks hierarchy.

Parameters

callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

search

void chrome.bookmarks.search(, string query, function callback)

Seaches for BookmarkTreeNodes matching the given query.

Parameters

query
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of BookmarkTreeNode results) {...});
results
( Type array of BookmarkTreeNode array of string or array of string string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

create

void chrome.bookmarks.create(, object bookmark, function callback)

Undocumented.

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

Parameters

bookmark
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
parentId
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( optional Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
url
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(BookmarkTreeNode result) {...});
result
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

move

void chrome.bookmarks.move(, string id, object destination, function callback)

Moves the specified BookmarkTreeNode to the provided location.

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
destination
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
parentId
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( optional Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

update

void chrome.bookmarks.update(, string id, object changes, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
changes
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(BookmarkTreeNode result) {...});
result
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

remove

void chrome.bookmarks.remove(, string id, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

removeTree

void chrome.bookmarks.removeTree(, string id, function callback)

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

Events

onAdded

chrome.bookmarks.onAdded.addListener(function(string id, BookmarkTreeNode bookmark) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
bookmark
( BookmarkTreeNode array of string or array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids

onRemoved

chrome.bookmarks.onRemoved.addListener(function(string id, object removeInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
removeInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
parentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids

onChanged

chrome.bookmarks.onChanged.addListener(function(string id, object changeInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
changeInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids

onMoved

chrome.bookmarks.onMoved.addListener(function(string id, object moveInfo) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
moveInfo
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
parentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
oldParentId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
oldIndex
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids

onChildrenReordered

chrome.bookmarks.onChildrenReordered.addListener(function(string id, arary childIds) {...});

Undocumented.

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

Parameters

id
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
childIds
( Type array of arary )
Undocumented.
A single string-valued id, or an array of string-valued ids

Types

BookmarkTreeNode

idOrIdList
( Type array of object )
Undocumented.
A single string-valued id, or an array of string-valued ids
id
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
index
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
windowId
( Type array of integer )
Undocumented.
A single string-valued id, or an array of string-valued ids
selected
( Type array of boolean )
Undocumented.
A single string-valued id, or an array of string-valued ids
url
( Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
title
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
favIconUrl
( optional Type array of string )
Undocumented.
A single string-valued id, or an array of string-valued ids
diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html index 2ac70c6..668929e 100755 --- a/chrome/common/extensions/docs/content_scripts.html +++ b/chrome/common/extensions/docs/content_scripts.html @@ -1 +1 @@ - [object HTMLDivElement]
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.

+ [object HTMLDivElement]
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/devguide.html b/chrome/common/extensions/docs/devguide.html index 50e9b8a..3673801 100755 --- a/chrome/common/extensions/docs/devguide.html +++ b/chrome/common/extensions/docs/devguide.html @@ -1 +1 @@ - [object HTMLDivElement]
Developer Guide

[PENDING: intro to the guide goes here. say where to go. lots o' links.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

+ [object HTMLDivElement]
Developer Guide

[PENDING: intro to the guide goes here. say where to go. lots o' links.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html index 74ae659..0cf4fad 100755 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -1 +1 @@ - [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. connect
  3. Events
    1. onConnect
  4. Types
    1. Port
[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?]

Methods

connect

Port chrome.extension.connect(, string name)

Attempts to connect to other listeners within the extension (listeners may be toolstrips or the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Extensions may connect to content scripts embedded in tabs via chrome.tabs.connectToTab.

Parameters

name
( optional Type array of string )
Will be passed into onConnect for extension processes that are listening for the connection event.

Returns

name
( Port array of string )
Port through which messages can be sent and received with the extension.

Callback function

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

function(Type param1, Type param2) {...});

Events

onConnect

chrome.bookmarks.onConnect.addListener(function(Port port) {...});

Fired when a connection is made from either an extension process or a content script.

Parameters

port
( Port array of string )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.

Types

Port

name
( Type array of object )
An object which allows two way communication with other pages.
name
( Type array of string )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
onDisconnect
( Type array of object )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
onMessage
( Type array of object )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
postMessage
( Type array of function )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
+ [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. connect
    2. getViews
    3. getBackgroundPage
    4. getToolstrips
    5. getTabContentses
  3. Events
    1. onConnect
  4. Types
    1. Port
[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?]

Methods

connect

Port chrome.extension.connect(, string name)

Attempts to connect to other listeners within the extension (listeners may be toolstrips or the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Extensions may connect to content scripts embedded in tabs via chrome.tabs.connectToTab.

Parameters

name
( optional Type array of string )
Will be passed into onConnect for extension processes that are listening for the connection event.

Returns

name
( Port array of string )
Port through which messages can be sent and received with the extension.

Callback function

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

function(Type param1, Type param2) {...});

getViews

array of object chrome.extension.getViews(, )

Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.

Parameters

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

Returns

name
( Type array of Type array of object string )
Array of global objects

Callback function

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

function(Type param1, Type param2) {...});

getBackgroundPage

object chrome.extension.getBackgroundPage(, )

Returns the global JavaScript object for the background page running inside the current extension. Returns null if the extension has no backround page.

Parameters

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

Returns

name
( Type array of object )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.

Callback function

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

function(Type param1, Type param2) {...});

getToolstrips

array of object chrome.extension.getToolstrips(, integer windowId)

Returns an array of the global JavaScript objects for each of the toolstrip views running inside the current extension. If windowId is specified, returns only the toolstrips attached to the specified window.

Parameters

windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Returns

name
( Type array of Type array of object string )
Array of global objects

Callback function

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

function(Type param1, Type param2) {...});

getTabContentses

array of object chrome.extension.getTabContentses(, integer windowId)

Returns an array of the global JavaScript objects for each of the tab contents views running inside the current extension. If windowId is specified, returns only the tab contentses attached to the specified window.

Parameters

windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Returns

name
( Type array of Type array of object string )
Array of global objects

Callback function

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

function(Type param1, Type param2) {...});

Events

onConnect

chrome.bookmarks.onConnect.addListener(function(Port port) {...});

Fired when a connection is made from either an extension process or a content script.

Parameters

port
( Port array of string )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.

Types

Port

name
( Type array of object )
An object which allows two way communication with other pages.
name
( Type array of string )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
onDisconnect
( Type array of object )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
onMessage
( Type array of object )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
postMessage
( Type array of function )
Undocumented.
Will be passed into onConnect for extension processes that are listening for the connection event.
diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html index 02417b6..ea327bc 100755 --- a/chrome/common/extensions/docs/getstarted.html +++ b/chrome/common/extensions/docs/getstarted.html @@ -1 +1 @@ - [object HTMLDivElement]
Getting Started

This tutorial walks you through creating a simple extension. To complete this tutorial, you must have Windows; Linux and Mac don't yet support extensions.

Get your browser ready

To develop extensions for Google Chrome, you need to set up your browser:

  1. Subscribe to the Dev channel of Google Chrome for Windows.
  2. Create a separate profile for testing (optional but highly recommended). Having a testing profile means that you can use Google Chrome (with your default profile) for everyday browsing, even if your extension has horrible bugs.

Create and load an extension

In this section, you'll write a toolstrip — an extension that puts a bit of UI into the toolbar at the bottom of the Google Chrome window.

  1. Create a folder somewhere on your computer to contain your extension's code. We'll assume the folder is located at c:\myext, but it can be anywhere.
  2. Inside your extension's folder, create a text file called manifest.json, and put this in it:
    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "my_toolstrip.html" ] }
  3. In the same folder, create a text file called my_toolstrip.html, and put this in it:
    <div class="toolstrip-button"> <span>Hello, World!</span> </div>
  4. Load the extension:
    1. Change the shortcut that you use to start the browser (or create a new one) so that it has the --enable-extensions and --load-extension flags. For example, if your extension is at c:\myext, your shortcut might look something like this:
      chrome.exe --enable-extensions --load-extension="c:\myext"
    2. Exit Google Chrome. If you have a separate profile for testing, you only need to exit the browser instances that use the testing profile.
    3. Double-click the shortcut to start the browser.

    Note: For details on changing shortcut properties, see Creating and Using Profiles.

You should see the UI for your extension at the bottom left of the browser, looking something like this:

default appearance initial onhover appearance final onhover appearance

Your extension's button is automatically styled to look like it belongs in the browser. If you put the cursor over the button, the button gets a nice, rounded edge, just like the buttons in the bookmark bar. After a while, a tooltip comes up, identifying the extension.

[PENDING: troubleshooting info should go here. what are symptoms of common typos, including misnamed files? what are the symptoms if you don't have the dev channel?]

Add code to the extension

In this step, you'll make your extension do something besides just look good.

  1. Inside your extension's folder, create a text file called hello_world.html, and add the following code to it:

    CSS and JavaScript code for hello_world
  2. Edit my_toolstrip.html, so that it has the following code:

    <div class="toolstrip-button" onclick="window.open('hello_world.html')"> <span>Hello, World!</span> </div>
  3. Restart the browser to load the new version of the extension.
  4. Click the button. A window should come up that displays hello_world.html.

It should look something like this:

a window with a grid of images related to HELLO WORLD

If you don't see that page, try the instructions again, following them exactly. Don't try loading an HTML file that isn't in the extension's folder — it won't work!

Debug the extension

You can use the browser's built-in developer tools to view your extension's code, display debugging output, and debug your extension.

  1. Edit my_toolstrip.html, so that it has the following code:

    <script> function helloWorld() { var hwFile = 'hello_world.html'; console.log("in helloWorld()"); window.open(hwFile); } </script> <div class="toolstrip-button" onclick="helloWorld();"> <span>Hello, World!</span> </div>

    The relocated code still has the same effect, but now it has some debugging output, thanks to the call to console.log().

  2. Restart the browser, so that it loads your new version of the extension.
  3. Right-click the Hello, World! button (at the bottom left) to bring up the Developer Tools window for this instance of your toolstrip. The window should look something like this:

  4. Click the Scripts button. If necessary, choose my_toolstrip.html from the list of scripts. The result should be something like this:

  5. Set a debugging breakpoint at the window.open() statement by clicking 5 in the left column:

  6. Click the Console button (second from left, at the bottom of the Developer Tools window) so that you can see both the code and the console.

  7. Back in the main browser window, click the Hello, World! button, so that the extension begins executing. You should see the output of console.log() along with the line number, and execution should stop just before the call to window.open().

    The Call Stack area at the right of the tools window shows that the helloWorld() method was called by an anonymous function that was called by onclick. Anywhere in the Call Stack or console that you see a file and line number (for example, "my_toolstrip.html:4"), you can click that text to see the relevant line of code.

  8. In the upper right part of the tools window, scroll down (if necessary) until you can see the local scope variables. This section shows the current values of all variables in the current scope. For example, you can see that hwFile is a local variable that has the value "hello_world.html".

  9. Click the buttons at the upper right of the window to resume execution or to step through the code. Once the call to window.open() returns, the main browser window should open a new tab that displays the contents of hello_world.html.

You now know how to load and debug an extension!

Summary

[PENDING: Summarize what we did, what it means, what else we would've done if this were a real extension (e.g. package it), and where to find more information. Suggest where to go next.]

+ [object HTMLDivElement]
Getting Started

This tutorial walks you through creating a simple extension. To complete this tutorial, you must have Windows; Linux and Mac don't yet support extensions.

Get your browser ready

To develop extensions for Google Chrome, you need to set up your browser:

  1. Subscribe to the Dev channel of Google Chrome for Windows.
  2. Create a separate profile for testing (optional but highly recommended). Having a testing profile means that you can use Google Chrome (with your default profile) for everyday browsing, even if your extension has horrible bugs.

Create and load an extension

In this section, you'll write a toolstrip — an extension that puts a bit of UI into the toolbar at the bottom of the Google Chrome window.

  1. Create a folder somewhere on your computer to contain your extension's code. We'll assume the folder is located at c:\myext, but it can be anywhere.
  2. Inside your extension's folder, create a text file called manifest.json, and put this in it:
    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "my_toolstrip.html" ] }
  3. In the same folder, create a text file called my_toolstrip.html, and put this in it:
    <div class="toolstrip-button"> <span>Hello, World!</span> </div>
  4. Load the extension:
    1. Change the shortcut that you use to start the browser (or create a new one) so that it has the --enable-extensions and --load-extension flags. For example, if your extension is at c:\myext, your shortcut might look something like this:
      chrome.exe --enable-extensions --load-extension="c:\myext"
    2. Exit Google Chrome. If you have a separate profile for testing, you only need to exit the browser instances that use the testing profile.
    3. Double-click the shortcut to start the browser.

    Note: For details on changing shortcut properties, see Creating and Using Profiles.

You should see the UI for your extension at the bottom left of the browser, looking something like this:

default appearance initial onhover appearance final onhover appearance

Your extension's button is automatically styled to look like it belongs in the browser. If you put the cursor over the button, the button gets a nice, rounded edge, just like the buttons in the bookmark bar. After a while, a tooltip comes up, identifying the extension.

[PENDING: troubleshooting info should go here. what are symptoms of common typos, including misnamed files? what are the symptoms if you don't have the dev channel?]

Add code to the extension

In this step, you'll make your extension do something besides just look good.

  1. Inside your extension's folder, create a text file called hello_world.html, and add the following code to it:

    CSS and JavaScript code for hello_world
  2. Edit my_toolstrip.html, so that it has the following code:

    <div class="toolstrip-button" onclick="window.open('hello_world.html')"> <span>Hello, World!</span> </div>
  3. Restart the browser to load the new version of the extension.
  4. Click the button. A window should come up that displays hello_world.html.

It should look something like this:

a window with a grid of images related to HELLO WORLD

If you don't see that page, try the instructions again, following them exactly. Don't try loading an HTML file that isn't in the extension's folder — it won't work!

Debug the extension

You can use the browser's built-in developer tools to view your extension's code, display debugging output, and debug your extension.

  1. Edit my_toolstrip.html, so that it has the following code:

    <script> function helloWorld() { var hwFile = 'hello_world.html'; console.log("in helloWorld()"); window.open(hwFile); } </script> <div class="toolstrip-button" onclick="helloWorld();"> <span>Hello, World!</span> </div>

    The relocated code still has the same effect, but now it has some debugging output, thanks to the call to console.log().

  2. Restart the browser, so that it loads your new version of the extension.
  3. Right-click the Hello, World! button (at the bottom left) to bring up the Developer Tools window for this instance of your toolstrip. The window should look something like this:

  4. Click the Scripts button. If necessary, choose my_toolstrip.html from the list of scripts. The result should be something like this:

  5. Set a debugging breakpoint at the window.open() statement by clicking 5 in the left column:

  6. Click the Console button (second from left, at the bottom of the Developer Tools window) so that you can see both the code and the console.

  7. Back in the main browser window, click the Hello, World! button, so that the extension begins executing. You should see the output of console.log() along with the line number, and execution should stop just before the call to window.open().

    The Call Stack area at the right of the tools window shows that the helloWorld() method was called by an anonymous function that was called by onclick. Anywhere in the Call Stack or console that you see a file and line number (for example, "my_toolstrip.html:4"), you can click that text to see the relevant line of code.

  8. In the upper right part of the tools window, scroll down (if necessary) until you can see the local scope variables. This section shows the current values of all variables in the current scope. For example, you can see that hwFile is a local variable that has the value "hello_world.html".

  9. Click the buttons at the upper right of the window to resume execution or to step through the code. Once the call to window.open() returns, the main browser window should open a new tab that displays the contents of hello_world.html.

You now know how to load and debug an extension!

Summary

[PENDING: Summarize what we did, what it means, what else we would've done if this were a real extension (e.g. package it), and where to find more information. Suggest where to go next.]

diff --git a/chrome/common/extensions/docs/index.html b/chrome/common/extensions/docs/index.html index 863d46d..e489689 100755 --- a/chrome/common/extensions/docs/index.html +++ b/chrome/common/extensions/docs/index.html @@ -1 +1 @@ - [object HTMLDivElement]
Chrome Extensions Developer Documentation

If you want to customize Google Chrome, you've come to the right place. An extension is a bundle of web code (HTML, JavaScript, perhaps some CSS) that lets you add functionality or a bit of user interface (usually both) to the browser. Examples of extensions include a mail checker, a newsfeed subscriber, and a status monitor.

[Maybe add some nice enticing pictures of toolstrips and moles (when we have them)]

If you just want to dive in, try Get Started. Otherwise, if you'd prefer to start with the high level overview, try Overview.

+ [object HTMLDivElement]
Chrome Extensions Developer Documentation

If you want to customize Google Chrome, you've come to the right place. An extension is a bundle of web code (HTML, JavaScript, perhaps some CSS) that lets you add functionality or a bit of user interface (usually both) to the browser. Examples of extensions include a mail checker, a newsfeed subscriber, and a status monitor.

[Maybe add some nice enticing pictures of toolstrips and moles (when we have them)]

If you just want to dive in, try Get Started. Otherwise, if you'd prefer to start with the high level overview, try Overview.

diff --git a/chrome/common/extensions/docs/manifest.html b/chrome/common/extensions/docs/manifest.html index 75fa0ec..a93bd0d 100755 --- a/chrome/common/extensions/docs/manifest.html +++ b/chrome/common/extensions/docs/manifest.html @@ -1 +1 @@ - [object HTMLDivElement]

This page should go into detail about all the parts of the manifest. In cases where there's not too much to say about something (icons, cross-origin XHR), we can just document it inline. Otherwise (content scripts), we can link off to a separate page.

+ [object HTMLDivElement]

This page should go into detail about all the parts of the manifest. In cases where there's not too much to say about something (icons, cross-origin XHR), we can just document it inline. Otherwise (content scripts), we can link off to a separate page.

diff --git a/chrome/common/extensions/docs/overview.html b/chrome/common/extensions/docs/overview.html index cabdadb..548a48c 100755 --- a/chrome/common/extensions/docs/overview.html +++ b/chrome/common/extensions/docs/overview.html @@ -1 +1 @@ - [object HTMLDivElement]

This page should perhaps be renamed from "overview" to "concepts". In any case, what I'd like to cover here is the conceptual underpinning of extensions, such as:

  • Zip file of web pages
  • All resources accessible with a URL scheme
  • How IDs are generated
  • The manifest
  • The background page, how extensions are typically structured
  • Process model
  • Content scripts (lightweight, link off to other page for details)
  • Asynchronous APIs
  • Extension IDs, how they are generated
  • How packaging works at a high level (lightweight, link off to other page for details)
+ [object HTMLDivElement]

This page should perhaps be renamed from "overview" to "concepts". In any case, what I'd like to cover here is the conceptual underpinning of extensions, such as:

  • Zip file of web pages
  • All resources accessible with a URL scheme
  • How IDs are generated
  • The manifest
  • The background page, how extensions are typically structured
  • Process model
  • Content scripts (lightweight, link off to other page for details)
  • Asynchronous APIs
  • Extension IDs, how they are generated
  • How packaging works at a high level (lightweight, link off to other page for details)
diff --git a/chrome/common/extensions/docs/packaging.html b/chrome/common/extensions/docs/packaging.html index c2e4c9d..80cc36a 100755 --- a/chrome/common/extensions/docs/packaging.html +++ b/chrome/common/extensions/docs/packaging.html @@ -1 +1 @@ - [object HTMLDivElement]

Extensions are packaged as signed zip files with the file extension "crx" (eg myextension.crx). Each extension has its own unique key pair. The public key is used as the unique identifier for the extension and the private key is kept private and used to sign each version of the extension.

Packaging an Extension

To package an extension:

  1. Close all your Chrome windows
  2. Open a command line and type:
    <path-to-chrome>\chrome.exe --pack-extension=<path\to\extension\folder> 

Note

  • In Windows XP, you can find by right-clicking on your Google Chrome shortcut and selecting Properties -> Shortcut and then pressing Find Target.
  • In Vista, you can do the same by right-clicking your Google Chrome shortcut and selecting Open File Location.

The packager creates two files: a crx file (myextension.crx), which is the actual extension that can be installed, and a private key (myextension.pem). You should keep the private key secret and in a safe place.

IMPORTANT: Do not lose the private key. You will need it later for two things

  1. If you want to create a new version of the extension, you'll need the original private key (see below).
  2. In the future, Google will implement a gallery service for extensions. You'll need your private key if you want to import an existing extension into that gallery.

Updating an Extension

To create an updated version of your extension:

  1. Increase the version number in manifest.json
  2. Close all your Chrome windows
  3. Run \chrome.exe --pack-extension= --pack-extension-key=, specifying the private key file you created earlier for the second parameter.

If the updated extension is successfully packaged, you'll see a dialog like this

Tips and Tricks

  • In build 3.0.195 and later, you can use the --no-message-box command line flag to suppress the dialog. This is useful if you're packing extensions in non-interactive scripts.
+ [object HTMLDivElement]

Extensions are packaged as signed zip files with the file extension "crx" (eg myextension.crx). Each extension has its own unique key pair. The public key is used as the unique identifier for the extension and the private key is kept private and used to sign each version of the extension.

Packaging an Extension

To package an extension:

  1. Close all your Chrome windows
  2. Open a command line and type:
    <path-to-chrome>\chrome.exe --pack-extension=<path\to\extension\folder> 

Note

  • In Windows XP, you can find by right-clicking on your Google Chrome shortcut and selecting Properties -> Shortcut and then pressing Find Target.
  • In Vista, you can do the same by right-clicking your Google Chrome shortcut and selecting Open File Location.

The packager creates two files: a crx file (myextension.crx), which is the actual extension that can be installed, and a private key (myextension.pem). You should keep the private key secret and in a safe place.

IMPORTANT: Do not lose the private key. You will need it later for two things

  1. If you want to create a new version of the extension, you'll need the original private key (see below).
  2. In the future, Google will implement a gallery service for extensions. You'll need your private key if you want to import an existing extension into that gallery.

Updating an Extension

To create an updated version of your extension:

  1. Increase the version number in manifest.json
  2. Close all your Chrome windows
  3. Run \chrome.exe --pack-extension= --pack-extension-key=, specifying the private key file you created earlier for the second parameter.

If the updated extension is successfully packaged, you'll see a dialog like this

Tips and Tricks

  • In build 3.0.195 and later, you can use the --no-message-box command line flag to suppress the dialog. This is useful if you're packing extensions in non-interactive scripts.
diff --git a/chrome/common/extensions/docs/pageActions.html b/chrome/common/extensions/docs/pageActions.html index 1b5225a..cf9caaf 100755 --- a/chrome/common/extensions/docs/pageActions.html +++ b/chrome/common/extensions/docs/pageActions.html @@ -1 +1 @@ - [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. enableForTab
    2. disableForTab
  3. Events
    1. eventName
  4. Types
    1. id
[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?]

Page actions are a simple way to represent actions that can be taken on a page ("Email this page", "Share with Facebook", etc).

Status

First version implemented.

User interface

Page actions are displayed in the right side of the Omnibox. New actions get added to the left of the star:

A maximum of 8 (?) actions can appear at the top level, any additional ones overflow into a drop-down menu:

Manifest

Developers can include page actions in the manifest using the following syntax:

"page_actions": [ { "id": "myaction", // chosen by developer, and should be unique within their extension "name": "Do action", "icons": ["favicon.png", "favicon2.png"] } ]

Supported icon image formats include for example png, bmp, ico, jpg, gif. If an image larger than 16x16 is specified, it will be resized to fit.

Methods

enableForTab

void chrome.pageActions.enableForTab(, string pageActionId, object action)

Undocumented.

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

Parameters

pageActionId
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
action
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
iconId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Type param1, Type param2) {...});

disableForTab

void chrome.pageActions.disableForTab(, string pageActionId, object action)

Undocumented.

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

Parameters

pageActionId
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
action
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Type param1, Type param2) {...});
+ [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. enableForTab
    2. disableForTab
  3. Events
    1. eventName
  4. Types
    1. id
[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?]

Page actions are a simple way to represent actions that can be taken on a page ("Email this page", "Share with Facebook", etc).

Status

First version implemented.

User interface

Page actions are displayed in the right side of the Omnibox. New actions get added to the left of the star:

A maximum of 8 (?) actions can appear at the top level, any additional ones overflow into a drop-down menu:

Manifest

Developers can include page actions in the manifest using the following syntax:

"page_actions": [ { "id": "myaction", // chosen by developer, and should be unique within their extension "name": "Do action", "icons": ["favicon.png", "favicon2.png"] } ]

Supported icon image formats include for example png, bmp, ico, jpg, gif. If an image larger than 16x16 is specified, it will be resized to fit.

Methods

enableForTab

void chrome.pageActions.enableForTab(, string pageActionId, object action)

Undocumented.

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

Parameters

pageActionId
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
action
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
iconId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Type param1, Type param2) {...});

disableForTab

void chrome.pageActions.disableForTab(, string pageActionId, object action)

Undocumented.

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

Parameters

pageActionId
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
action
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Type param1, Type param2) {...});
diff --git a/chrome/common/extensions/docs/self.html b/chrome/common/extensions/docs/self.html deleted file mode 100755 index e963728..0000000 --- a/chrome/common/extensions/docs/self.html +++ /dev/null @@ -1 +0,0 @@ - [object HTMLDivElement]

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. getViews
  3. Events
    1. eventName
  4. Types
    1. id
[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

getViews

array of object chrome.self.getViews(, )

Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.

Parameters

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

Returns

paramName
( Type array of Type array of object paramType )
Array of HTMLWindow objects

Callback function

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

function(Type param1, Type param2) {...});
diff --git a/chrome/common/extensions/docs/static/self.html b/chrome/common/extensions/docs/static/self.html deleted file mode 100755 index 997b579..0000000 --- a/chrome/common/extensions/docs/static/self.html +++ /dev/null @@ -1,5 +0,0 @@ - -

-[PENDING: API Module Overview Goes Here] -

- diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index f609c4b..4e52aff 100755 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -1 +1 @@ - [object HTMLDivElement]

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
    10. captureVisibleTab
  3. Events
    1. onCreated
    2. onUpdated
    3. onMoved
    4. onSelectionChanged
    5. onAttached
    6. onDetached
    7. onRemoved
  4. Types
    1. Tab
[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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
Undocumented.
Description of this parameter from the json schema.

connect

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

Undocumented.

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

Parameters

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

Returns

tabId
( Port array of integer )
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) {...});

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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of Tab tabs) {...});
tabs
( Type array of Tab array of integer integer )
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
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
selected
( optional Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
updateProperties
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
selected
( optional Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
moveProperties
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

detectLanguage

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

detect language of tab.

Parameters

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

Returns

Callback function

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

function(string language) {...});
language
( Type array of string )
Undocumented.
Description of this parameter from the json schema.

captureVisibleTab

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

Captures the visible area of the visible tab in the given window.

Parameters

windowId
( optional Type array of integer )
The target window. If null or undefined, the 'current' window will be assumed.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(string dataUrl) {...});
dataUrl
( Type array of string )
a data url encoding of the captured tab.

Events

onCreated

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

Undocumented.

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

Parameters

tab
( Tab array of integer )
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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
changedProps
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
status
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
MoveInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
fromIndex
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
toIndex
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
SelectInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
AttachInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
newWindowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
newPosition
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
DetachInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
oldWindowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
oldPosition
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Types

Tab

tabId
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
id
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
selected
( Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
favIconUrl
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
+ [object HTMLDivElement]

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
    10. captureVisibleTab
  3. Events
    1. onCreated
    2. onUpdated
    3. onMoved
    4. onSelectionChanged
    5. onAttached
    6. onDetached
    7. onRemoved
  4. Types
    1. Tab
[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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
Undocumented.
Description of this parameter from the json schema.

connect

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

Undocumented.

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

Parameters

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

Returns

tabId
( Port array of integer )
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) {...});

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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(array of Tab tabs) {...});
tabs
( Type array of Tab array of integer integer )
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
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
selected
( optional Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(Tab tab) {...});
tab
( Tab array of integer )
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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
updateProperties
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
selected
( optional Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
moveProperties
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( optional Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

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 Type array of integer )
Undocumented.
Description of this parameter from the json schema.
callback
( optional Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function() {...});

detectLanguage

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

detect language of tab.

Parameters

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

Returns

Callback function

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

function(string language) {...});
language
( Type array of string )
Undocumented.
Description of this parameter from the json schema.

captureVisibleTab

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

Captures the visible area of the visible tab in the given window.

Parameters

windowId
( optional Type array of integer )
The target window. If null or undefined, the 'current' window will be assumed.
callback
( Type array of function )
Undocumented.
Description of this parameter from the json schema.

Returns

Callback function

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

function(string dataUrl) {...});
dataUrl
( Type array of string )
a data url encoding of the captured tab.

Events

onCreated

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

Undocumented.

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

Parameters

tab
( Tab array of integer )
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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
changedProps
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
tabId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
status
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
url
( optional Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
MoveInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
fromIndex
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
toIndex
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
SelectInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
AttachInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
newWindowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
newPosition
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
DetachInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
oldWindowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
oldPosition
( Type array of 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
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.

Types

Tab

tabId
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
id
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
index
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
windowId
( Type array of integer )
Undocumented.
Description of this parameter from the json schema.
selected
( Type array of boolean )
Undocumented.
Description of this parameter from the json schema.
url
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
title
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
favIconUrl
( optional Type array of string )
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html index f48b0fe6..a85fe22 100755 --- a/chrome/common/extensions/docs/template/api_template.html +++ b/chrome/common/extensions/docs/template/api_template.html @@ -36,10 +36,10 @@
  • Page actions
  • Background pages
  • Content scripts
  • -
  • Extension
  • Tabs
  • Windows
  • -
  • Self
  • +
  • Bookmarks
  • +
  • Extension
  • NPAPI Plugins
  • Packaging
  • Autoupdate
  • diff --git a/chrome/common/extensions/docs/tool_strips.html b/chrome/common/extensions/docs/tool_strips.html deleted file mode 100755 index 027c67b..0000000 --- a/chrome/common/extensions/docs/tool_strips.html +++ /dev/null @@ -1 +0,0 @@ - Tool_strips

    Toolstrips allow you to add UI to Chrome's toolbar area. Toolstrips are nothing more than (very small) HTML pages, so anything you can do with HTML/CSS/JavaScript, you can do with toolstrips.

    Status

    Implementation in progress.

    Details

    Register your toolstrips in the extension manifest, like this:

    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "one_toolstrip.html", "two_toolstrip.html" ] }

    You can create buttons that look like the bookmark bar buttons using this template:

    <div class="toolstrip-button"> <!-- Image is optional and should be a 16x16 icon. --> <img src="path/to/some_icon.png"> <span>My Button</span> </div>

    Debugging Tips

    • You can right click on a toolstrip to get a web inspector.
    • alert(), prompt(), and confirm() don't work yet. Sorry about that.
    • You can run toolstrips in the main content area by loading their URL, which would be something like chrome-extension://0000000000000000000000000000000000000000/my_toolstrip.html

    Design Tips

    • Try not to use too much space. Toolbar real estate is precious and users tend to prefer extensions to use as little of it as possible.
    • The toolbar automatically detects how much space a toolstrip needs and reflows. So you can resize your toolstrip dynamically if you need a little more room temporarily.
    • If you need to do more extensive UI, use the tab contents area or a pop up window.
    • Remember that there can be multiple instances of a given toolstrip page running at one time. Each browser window has its own toolstrip. If you need long-running application logic, try Background Pages.
    diff --git a/chrome/common/extensions/docs/toolstrip.html b/chrome/common/extensions/docs/toolstrip.html index 21f4e3b..848ff73 100755 --- a/chrome/common/extensions/docs/toolstrip.html +++ b/chrome/common/extensions/docs/toolstrip.html @@ -1 +1 @@ - [object HTMLDivElement]

    Contents

    1. Description
      1. Properties
      2. Examples
    2. Methods
      1. expand
      2. collapse
    3. Events
      1. eventName
    4. Types
      1. id
    [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?]

    Toolstrips allow you to add UI to Chrome's toolbar area. Toolstrips are nothing more than (very small) HTML pages, so anything you can do with HTML/CSS/JavaScript, you can do with toolstrips.

    Status

    Implementation in progress.

    Details

    Register your toolstrips in the extension manifest, like this:

    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "one_toolstrip.html", "two_toolstrip.html" ] }

    You can create buttons that look like the bookmark bar buttons using this template:

    <div class="toolstrip-button"> <!-- Image is optional and should be a 16x16 icon. --> <img src="path/to/some_icon.png"> <span>My Button</span> </div>

    Debugging Tips

    • You can right click on a toolstrip to get a web inspector.
    • alert(), prompt(), and confirm() don't work yet. Sorry about that.
    • You can run toolstrips in the main content area by loading their URL, which would be something like chrome-extension://0000000000000000000000000000000000000000/my_toolstrip.html

    Design Tips

    • Try not to use too much space. Toolbar real estate is precious and users tend to prefer extensions to use as little of it as possible.
    • The toolbar automatically detects how much space a toolstrip needs and reflows. So you can resize your toolstrip dynamically if you need a little more room temporarily.
    • If you need to do more extensive UI, use the tab contents area or a pop up window.
    • Remember that there can be multiple instances of a given toolstrip page running at one time. Each browser window has its own toolstrip. If you need long-running application logic, try Background Pages.

    Methods

    expand

    void chrome.toolstrip.expand(, integer height, string url, function callback)

    Undocumented.

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

    Parameters

    height
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});

    collapse

    void chrome.toolstrip.collapse(, string url, function callback)

    Undocumented.

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

    Parameters

    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});
    + [object HTMLDivElement]

    Contents

    1. Description
      1. Properties
      2. Examples
    2. Methods
      1. expand
      2. collapse
    3. Events
      1. eventName
    4. Types
      1. id
    [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?]

    Toolstrips allow you to add UI to Chrome's toolbar area. Toolstrips are nothing more than (very small) HTML pages, so anything you can do with HTML/CSS/JavaScript, you can do with toolstrips.

    Status

    Implementation in progress.

    Details

    Register your toolstrips in the extension manifest, like this:

    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "one_toolstrip.html", "two_toolstrip.html" ] }

    You can create buttons that look like the bookmark bar buttons using this template:

    <div class="toolstrip-button"> <!-- Image is optional and should be a 16x16 icon. --> <img src="path/to/some_icon.png"> <span>My Button</span> </div>

    Debugging Tips

    • You can right click on a toolstrip to get a web inspector.
    • alert(), prompt(), and confirm() don't work yet. Sorry about that.
    • You can run toolstrips in the main content area by loading their URL, which would be something like chrome-extension://0000000000000000000000000000000000000000/my_toolstrip.html

    Design Tips

    • Try not to use too much space. Toolbar real estate is precious and users tend to prefer extensions to use as little of it as possible.
    • The toolbar automatically detects how much space a toolstrip needs and reflows. So you can resize your toolstrip dynamically if you need a little more room temporarily.
    • If you need to do more extensive UI, use the tab contents area or a pop up window.
    • Remember that there can be multiple instances of a given toolstrip page running at one time. Each browser window has its own toolstrip. If you need long-running application logic, try Background Pages.

    Methods

    expand

    void chrome.toolstrip.expand(, integer height, string url, function callback)

    Undocumented.

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

    Parameters

    height
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});

    collapse

    void chrome.toolstrip.collapse(, string url, function callback)

    Undocumented.

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

    Parameters

    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});
    diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index db1daf0f4..4ddd91e 100755 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -1 +1 @@ - [object HTMLDivElement]

    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. Types
      1. Window
    [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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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 Type array of boolean )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(array of object windows) {...});
    windows
    ( Type array of Type array of object integer )
    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 Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    width
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    height
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    updateInfo
    ( Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    width
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    height
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});

    Events

    onCreated

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

    Undocumented.

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

    Parameters

    windowId
    ( Type array of integer )
    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
    ( Type array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.

    Types

    Window

    windowId
    ( Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    id
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    focused
    ( Type array of boolean )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    bottom
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    right
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    tabs
    ( optional Type array of Tab array of integer integer )
    Undocumented.
    Description of this parameter from the json schema.
    + [object HTMLDivElement]

    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. Types
      1. Window
    [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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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 Type array of boolean )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(array of object windows) {...});
    windows
    ( Type array of Type array of object integer )
    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 Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    url
    ( optional Type array of string )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    width
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    height
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    updateInfo
    ( Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    width
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    height
    ( optional Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function(Window window) {...});
    window
    ( Window array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    callback
    ( optional Type array of function )
    Undocumented.
    Description of this parameter from the json schema.

    Returns

    Callback function

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

    function() {...});

    Events

    onCreated

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

    Undocumented.

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

    Parameters

    windowId
    ( Type array of integer )
    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
    ( Type array of integer )
    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
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.

    Types

    Window

    windowId
    ( Type array of object )
    Undocumented.
    Description of this parameter from the json schema.
    id
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    focused
    ( Type array of boolean )
    Undocumented.
    Description of this parameter from the json schema.
    left
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    top
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    bottom
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    right
    ( Type array of integer )
    Undocumented.
    Description of this parameter from the json schema.
    tabs
    ( optional Type array of Tab array of integer integer )
    Undocumented.
    Description of this parameter from the json schema.
    -- cgit v1.1