From a1286fea02e1a0cafddfecce0e806929f957b1ec Mon Sep 17 00:00:00 2001 From: "rafaelw@chromium.org" Date: Thu, 13 Aug 2009 01:27:36 +0000 Subject: Extension Doc Changes (no building or testable changes) -Don't display Event or Methods heading if there are none in api pages. -Allow static pages to declare their title with a hidden div. -Removed xhr.html (abandoned). -Left Nav now selects current page. -Breadcrumb removed. TBR=aa, kathyw Review URL: http://codereview.chromium.org/164457 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23275 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/extensions/docs/api_index.html | 2 +- .../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/css/ApiRefStyles.css | 10 ++++- 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 +- .../extensions/docs/js/api_page_generator.js | 36 ++++++++++++++++-- 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 | 2 +- .../extensions/docs/static/background_pages.html | 4 +- .../extensions/docs/static/content_scripts.html | 2 + chrome/common/extensions/docs/static/devguide.html | 2 + .../common/extensions/docs/static/getstarted.html | 2 + chrome/common/extensions/docs/static/index.html | 2 + chrome/common/extensions/docs/tabs.html | 2 +- .../extensions/docs/template/api_template.html | 44 ++++++++++------------ chrome/common/extensions/docs/toolstrip.html | 2 +- chrome/common/extensions/docs/windows.html | 2 +- chrome/common/extensions/docs/xhr.html | 1 - 25 files changed, 86 insertions(+), 49 deletions(-) delete mode 100755 chrome/common/extensions/docs/xhr.html diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html index 0adc00a..c675869 100755 --- a/chrome/common/extensions/docs/api_index.html +++ b/chrome/common/extensions/docs/api_index.html @@ -1 +1 @@ - Api_index

[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.

+ Api_index

[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 6247658..c7395f0 100755 --- a/chrome/common/extensions/docs/background_pages.html +++ b/chrome/common/extensions/docs/background_pages.html @@ -1 +1 @@ - 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; }
+ Background Pages
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 3b4d127..a3ef0d5 100755 --- a/chrome/common/extensions/docs/bookmarks.html +++ b/chrome/common/extensions/docs/bookmarks.html @@ -1 +1 @@ - chrome.bookmarks API Reference

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. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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 (string or array of string)
A single string-valued id, or an array of string-valued ids
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

getChildren

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

Retrieves the children of the specified BookmarkTreeNode id.

Parameters

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

Returns

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

Callback function

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

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

getTree

void chrome.bookmarks.getTree(, function callback)

Retrieves the entire Bookmarks hierarchy.

Parameters

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

Returns

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

Callback function

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

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

search

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

Seaches for BookmarkTreeNodes matching the given query.

Parameters

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

Returns

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

Callback function

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

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

create

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

Undocumented.

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

Parameters

bookmark (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

move

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

Moves the specified BookmarkTreeNode to the provided location.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
destination (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
changes (object)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

removeTree

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

Events

onAdded

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

Undocumented.

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

Parameters

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

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
RemoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
parentId (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangeInfo (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
parentId (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
oldParentId (integer)
Undocumented.
Description of this parameter from the json schema.
oldIndex (integer)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
childIds (arary)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
+ chrome.bookmarks API Reference

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. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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 (string or array of string)
A single string-valued id, or an array of string-valued ids
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

getChildren

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

Retrieves the children of the specified BookmarkTreeNode id.

Parameters

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

Returns

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

Callback function

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

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

getTree

void chrome.bookmarks.getTree(, function callback)

Retrieves the entire Bookmarks hierarchy.

Parameters

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

Returns

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

Callback function

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

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

search

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

Seaches for BookmarkTreeNodes matching the given query.

Parameters

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

Returns

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

Callback function

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

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

create

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

Undocumented.

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

Parameters

bookmark (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

move

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

Moves the specified BookmarkTreeNode to the provided location.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
destination (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
changes (object)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

removeTree

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

Events

onAdded

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

Undocumented.

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

Parameters

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

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
RemoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
parentId (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangeInfo (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
parentId (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
oldParentId (integer)
Undocumented.
Description of this parameter from the json schema.
oldIndex (integer)
Undocumented.
Description of this parameter from the json schema.

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
childIds (arary)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html index 4e1f266..c724983 100755 --- a/chrome/common/extensions/docs/content_scripts.html +++ b/chrome/common/extensions/docs/content_scripts.html @@ -1 +1 @@ - Content_scripts

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

Some examples of things that content scripts can do include:

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

Registration

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

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

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

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

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

Match Patterns

TODO

Execution Environment

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

For example, consider this simple page:

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

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

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

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

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

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

Messaging

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

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

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

[TODO: Complete this]

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.

+ Content Scripts
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/css/ApiRefStyles.css b/chrome/common/extensions/docs/css/ApiRefStyles.css index 212d65c..d3f6378 100755 --- a/chrome/common/extensions/docs/css/ApiRefStyles.css +++ b/chrome/common/extensions/docs/css/ApiRefStyles.css @@ -3,7 +3,11 @@ * So we should probably have a common CSS file, plus this one, and then * one for handwritten pages. */ -.todo { +.pageData { + display: none; +} + + .todo { color: red; } @@ -148,6 +152,10 @@ p#classSummary { padding:0.2em 0 0.2em 1em; } +.leftNavSelected { + background-color: rgb(229, 236, 249); +} + #mainColumn { border-left:3px solid #E5ECF9; padding-left:24px; diff --git a/chrome/common/extensions/docs/devguide.html b/chrome/common/extensions/docs/devguide.html index 9ac8b75..9e4ebf1 100755 --- a/chrome/common/extensions/docs/devguide.html +++ b/chrome/common/extensions/docs/devguide.html @@ -1 +1 @@ - Devguide

[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.

+ Developer Guide
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 7a7374d..67d1ba9 100755 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -1 +1 @@ - chrome.extension API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. connect
  3. Events
    1. onConnect
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

Methods

connect

object 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 string)
Will be passed into onConnect for extension processes that are listening for the connection event.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

<!--framePath //<!--frame0-->--> (object)
Port through which messages can be sent and received with the extension.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.
postMessage (function)
Undocumented.
Description of this parameter from the json schema.

Callback function

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

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

Events

onConnect

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

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

Parameters

port (object)
Undocumented.
Description of this parameter from the json schema.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.
postMessage (function)
Undocumented.
Description of this parameter from the json schema.
+ chrome.extension API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. connect
  3. Events
    1. onConnect
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

Methods

connect

object 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 string)
Will be passed into onConnect for extension processes that are listening for the connection event.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

<!--framePath //<!--frame0-->--> (object)
Port through which messages can be sent and received with the extension.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.
postMessage (function)
Undocumented.
Description of this parameter from the json schema.

Callback function

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

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

Events

onConnect

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

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

Parameters

port (object)
Undocumented.
Description of this parameter from the json schema.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.
postMessage (function)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html index a01d286..cb881a1 100755 --- a/chrome/common/extensions/docs/getstarted.html +++ b/chrome/common/extensions/docs/getstarted.html @@ -1 +1 @@ - Getstarted

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.]

+ Getting Started
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 133b7dd..c6834cd 100755 --- a/chrome/common/extensions/docs/index.html +++ b/chrome/common/extensions/docs/index.html @@ -1 +1 @@ - Index

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.

+ Chrome Extras Developer Documentation
Chrome Extras 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/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js index 34d61f6..ccc1aaf 100755 --- a/chrome/common/extensions/docs/js/api_page_generator.js +++ b/chrome/common/extensions/docs/js/api_page_generator.js @@ -168,6 +168,8 @@ function renderTemplate(schemaContent) { var output = document.getElementsByTagName("html")[0]; jstProcess(input, output); + selectCurrentPageOnLeftNav(); + // Show. var elm = document.getElementById("hider"); elm.parentNode.removeChild(elm); @@ -181,6 +183,25 @@ function serializePage() { return s.serializeToString(document); } +// Select the current page on the left nav. Note: if already rendered, this +// will not effect any nodes. +function selectCurrentPageOnLeftNav() { + var pathParts = document.location.href.split(/\//); + var pageBase = pathParts[pathParts.length - 1]; + var leftNav = document.getElementById("leftNav"); + var results = document.evaluate('.//li/a', leftNav, null, + XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); + while(node = results.iterateNext()) { + if (node.href.match(pageBase + "$")) { + var parent = node.parentNode; + parent.className = "leftNavSelected"; + parent.removeChild(node); + parent.appendChild(node.firstChild); + break; + } + } +} + function setupPageData(pageData, schema) { // Add a list of modules for the master TOC. pageData.apiModules = []; @@ -192,11 +213,18 @@ function setupPageData(pageData, schema) { pageData.apiModules.push(m); }); pageData.apiModules.sort(function(a, b) { return a.name > b.name; }); + + // Set the page title (in order of preference). + pageData.pageTitle = getDataFromPageHTML("pageData-title") || + pageData.pageTitle || + pageName; +} - if (!pageData.pageTitle) { - pageData.pageTitle = pageName; - pageData.h1Header = pageName; - } +function getDataFromPageHTML(id) { + var node = document.getElementById(id); + if (!node) + return; + return node.innerHTML; } /** diff --git a/chrome/common/extensions/docs/manifest.html b/chrome/common/extensions/docs/manifest.html index 5010fb9..0ad450f 100755 --- a/chrome/common/extensions/docs/manifest.html +++ b/chrome/common/extensions/docs/manifest.html @@ -1 +1 @@ - Manifest

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.

+ Manifest

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 9ecb149..0af1dac 100755 --- a/chrome/common/extensions/docs/overview.html +++ b/chrome/common/extensions/docs/overview.html @@ -1 +1 @@ - Overview

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)
+ Overview

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 7c84909..05900e7 100755 --- a/chrome/common/extensions/docs/packaging.html +++ b/chrome/common/extensions/docs/packaging.html @@ -1 +1 @@ - Packaging

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.
+ Packaging

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 15f270a..010000b 100755 --- a/chrome/common/extensions/docs/pageActions.html +++ b/chrome/common/extensions/docs/pageActions.html @@ -1 +1 @@ - chrome.pageActions API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. enableForTab
    2. disableForTab
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
action (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
iconId (optional integer)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

disableForTab

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

Events

+ chrome.pageActions API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. enableForTab
    2. disableForTab
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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 (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
action (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
iconId (optional integer)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

disableForTab

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/self.html b/chrome/common/extensions/docs/self.html index 5ae0e60..1b51f81 100755 --- a/chrome/common/extensions/docs/self.html +++ b/chrome/common/extensions/docs/self.html @@ -1 +1 @@ - chrome.self API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. getViews
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

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 paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

<!--framePath //<!--frame0-->--> (array of object)
Array of HTMLWindow objects
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

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

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

Events

+ chrome.self API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. getViews
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

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 paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

<!--framePath //<!--frame0-->--> (array of object)
Array of HTMLWindow objects
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

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

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/static/background_pages.html b/chrome/common/extensions/docs/static/background_pages.html index 1d6d094..3d99295 100755 --- a/chrome/common/extensions/docs/static/background_pages.html +++ b/chrome/common/extensions/docs/static/background_pages.html @@ -1,4 +1,5 @@ - +
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.

@@ -37,4 +38,3 @@ toolstrip.html (snippet): var elm = document.getElementById('checkbox'); elm.checked = checked; } - diff --git a/chrome/common/extensions/docs/static/content_scripts.html b/chrome/common/extensions/docs/static/content_scripts.html index 0f8b3bb..e71219d 100644 --- a/chrome/common/extensions/docs/static/content_scripts.html +++ b/chrome/common/extensions/docs/static/content_scripts.html @@ -1,3 +1,5 @@ +
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: diff --git a/chrome/common/extensions/docs/static/devguide.html b/chrome/common/extensions/docs/static/devguide.html index a4c9646b..f9923b8 100755 --- a/chrome/common/extensions/docs/static/devguide.html +++ b/chrome/common/extensions/docs/static/devguide.html @@ -1,3 +1,5 @@ +

Developer Guide
+

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

diff --git a/chrome/common/extensions/docs/static/getstarted.html b/chrome/common/extensions/docs/static/getstarted.html index 7c843fb..e413bab 100755 --- a/chrome/common/extensions/docs/static/getstarted.html +++ b/chrome/common/extensions/docs/static/getstarted.html @@ -1,3 +1,5 @@ +
Getting Started
+

This tutorial walks you through creating a simple extension. To complete this tutorial, you must have Windows; diff --git a/chrome/common/extensions/docs/static/index.html b/chrome/common/extensions/docs/static/index.html index 42ca82b..b18079f 100755 --- a/chrome/common/extensions/docs/static/index.html +++ b/chrome/common/extensions/docs/static/index.html @@ -1,3 +1,5 @@ +

Chrome Extras 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.

diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index 821359d..7b622c8 100755 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -1 +1 @@ - chrome.tabs API Reference

Contents

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

[PENDING: API Module Overview Goes Here]

Methods

get

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

connect

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

getSelected

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

getAllInWindow

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

create

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

move

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

detectLanguage

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

detect language of tab.

Parameters

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

Returns

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

Callback function

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

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

captureVisibleTab

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

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

Parameters

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

Returns

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

Callback function

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

function(string dataUrl) {...});
dataUrl (string)
a data url encoding of the captured tab.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

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

Undocumented.

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

Parameters

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

onUpdated

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

Undocumented.

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

Parameters

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

onMoved

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

Undocumented.

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

Parameters

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

onSelectionChanged

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

Undocumented.

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

Parameters

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

onAttached

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

Undocumented.

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

Parameters

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

onDetached

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

Undocumented.

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

Parameters

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

onRemoved

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

Undocumented.

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

Parameters

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

Contents

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

[PENDING: API Module Overview Goes Here]

Methods

get

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

connect

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

getSelected

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

getAllInWindow

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

create

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

move

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

detectLanguage

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

detect language of tab.

Parameters

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

Returns

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

Callback function

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

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

captureVisibleTab

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

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

Parameters

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

Returns

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

Callback function

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

function(string dataUrl) {...});
dataUrl (string)
a data url encoding of the captured tab.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

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

Undocumented.

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

Parameters

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

onUpdated

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

Undocumented.

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

Parameters

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

onMoved

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

Undocumented.

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

Parameters

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

onSelectionChanged

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

Undocumented.

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

Parameters

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

onAttached

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

Undocumented.

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

Parameters

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

onDetached

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

Undocumented.

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

Parameters

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

onRemoved

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

Undocumented.

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

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html index 94311f1..9329795 100755 --- a/chrome/common/extensions/docs/template/api_template.html +++ b/chrome/common/extensions/docs/template/api_template.html @@ -3,14 +3,6 @@ @@ -115,7 +109,7 @@
-
+

Methods

@@ -267,7 +261,7 @@
-
+

Events

diff --git a/chrome/common/extensions/docs/toolstrip.html b/chrome/common/extensions/docs/toolstrip.html index a88c14e..0600bf8 100755 --- a/chrome/common/extensions/docs/toolstrip.html +++ b/chrome/common/extensions/docs/toolstrip.html @@ -1 +1 @@ - chrome.toolstrip API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. expand
    2. collapse
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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

Returns

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

Callback function

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

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

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 string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

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

Events

+ chrome.toolstrip API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. expand
    2. collapse
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

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

Returns

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

Callback function

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

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

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 string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

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

Callback function

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

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index 6f1a8eb..63af366 100755 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -1 +1 @@ - chrome.windows API Reference

Contents

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

[PENDING: API Module Overview Goes Here]

Methods

get

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

Get window with given id.

Parameters

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

Returns

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

Callback function

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

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

getCurrent

void chrome.windows.getCurrent(, function callback)

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

Parameters

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

Returns

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

Callback function

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

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

getLastFocused

void chrome.windows.getLastFocused(, function callback)

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

Parameters

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

Returns

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

Callback function

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

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

getAll

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

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

Parameters

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

Returns

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

Callback function

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

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

create

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

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

Parameters

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

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

Events

onCreated

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

Undocumented.

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

Parameters

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

onRemoved

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

Undocumented.

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

Parameters

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

onFocusChanged

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

Undocumented.

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

Parameters

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

Contents

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

[PENDING: API Module Overview Goes Here]

Methods

get

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

Get window with given id.

Parameters

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

Returns

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

Callback function

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

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

getCurrent

void chrome.windows.getCurrent(, function callback)

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

Parameters

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

Returns

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

Callback function

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

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

getLastFocused

void chrome.windows.getLastFocused(, function callback)

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

Parameters

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

Returns

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

Callback function

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

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

getAll

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

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

Parameters

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

Returns

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

Callback function

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

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

create

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

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

Parameters

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

Returns

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

Callback function

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

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

update

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

remove

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

Undocumented.

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

Parameters

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

Returns

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

Callback function

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

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

Events

onCreated

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

Undocumented.

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

Parameters

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

onRemoved

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

Undocumented.

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

Parameters

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

onFocusChanged

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

Undocumented.

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

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/xhr.html b/chrome/common/extensions/docs/xhr.html deleted file mode 100755 index 763b689..0000000 --- a/chrome/common/extensions/docs/xhr.html +++ /dev/null @@ -1 +0,0 @@ - Xhr

The standard XMLHttpRequest object can be used to communicate with multiple origins (ie domains) from an extension. You must pre-register the domains you want to talk to in the manifest, like so:

{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "permissions": [ "http://www.blogger.com", "http://*.google.com" ] }

Status

Implemented, but we don't yet enforce the permissions; all origins are allowed for now.

-- cgit v1.1