diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 19:18:24 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 19:18:24 +0000 |
commit | 704dd3637a9e986f4636302c3ce11700fbdba4ab (patch) | |
tree | 548448356ffc01514561392263350c254bdfe850 /chrome/common/extensions/api | |
parent | c8a4adac77067c640bfe0a585a973bdc3fa1e6f9 (diff) | |
download | chromium_src-704dd3637a9e986f4636302c3ce11700fbdba4ab.zip chromium_src-704dd3637a9e986f4636302c3ce11700fbdba4ab.tar.gz chromium_src-704dd3637a9e986f4636302c3ce11700fbdba4ab.tar.bz2 |
Add chrome.extension to extension_api.json and docs.
This required making it so that extension_api.json definitions defer to existing bindings so that the chrome.extension object can remain setup in renderer_extension_bindings.js.
Also fixed a minor bug with error handling in the api_generator.js
Moved "Port" type to the new extension module.
Removed a bunch of trailing whitespace from the extension_api.json.
Review URL: http://codereview.chromium.org/165323
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/api')
-rwxr-xr-x | chrome/common/extensions/api/extension_api.json | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 37443f3..e98fdd3 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -1,5 +1,49 @@ [ { + "namespace": "extension", + "types": [ + { + "id": "Port", + "type": "object", + "properties": { + "name": {"type": "string"}, + "onDisconnect": {"type": "object"}, + "onMessage": {"type": "object"}, + "postMessage": {"type": "function"} + } + } + ], + "functions": [ + { + "name": "connect", + "type": "function", + "description": "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 <a href='broken'><var>chrome.tabs.connectToTab</var></a>.", + "parameters": [ + { + "name": "name", + "type": "string", + "description": "Will be passed into onConnect for extension processes that are listening for the connection event.", + "optional": true + } + ], + "returns": { + "$ref": "Port", + "description": "Port through which messages can be sent and received with the extension." + } + } + ], + "events": [ + { + "name": "onConnect", + "type": "function", + "description": "Fired when a connection is made from either an extension process or a content script.", + "parameters": [ + {"$ref": "Port", "name": "port"} + ] + } + ] + }, + { "namespace": "self", "types": [ ], @@ -211,15 +255,6 @@ "title": {"type": "string", "optional": true}, "favIconUrl": {"type": "string", "optional": true} } - }, - { - "id": "Port", - "type": "object", - "properties": { - "name": {"type": "string"}, - "onDisconnect": {"type": "object"}, - "onMessage": {"type": "object"} - } } ], "functions": [ @@ -258,7 +293,7 @@ "parameters": [ {"type": "integer", "name": "windowId", "minimum": 0, "optional": true}, { - "type": "function", + "type": "function", "name": "callback", "parameters": [ {"name": "tab", "$ref": "Tab"} @@ -273,7 +308,7 @@ "parameters": [ {"type": "integer", "name": "windowId", "minimum": 0, "optional": true}, { - "type": "function", + "type": "function", "name": "callback", "parameters": [ {"name": "tabs", "type": "array", "items": { "$ref": "Tab" } } @@ -537,10 +572,10 @@ "choices": [ {"type": "string"}, {"type": "array", "items": {"type": "string"}, "minItems": 1} - ] + ] }, { - "type": "function", + "type": "function", "name": "callback", "parameters": [ {"name": "results", "type": "array", "items": { "$ref": "BookmarkTreeNode"} } @@ -569,7 +604,7 @@ "description": "Retrieves the entire Bookmarks hierarchy.", "parameters": [ { - "type": "function", + "type": "function", "name": "callback", "parameters": [ {"name": "results", "type": "array", "items": { "$ref": "BookmarkTreeNode"} } @@ -584,7 +619,7 @@ "parameters": [ {"type": "string", "name": "query"}, { - "type": "function", + "type": "function", "name": "callback", "parameters": [ {"name": "results", "type": "array", "items": { "$ref": "BookmarkTreeNode"} } @@ -608,7 +643,7 @@ } }, { - "type": "function", + "type": "function", "name": "callback", "optional": true, "parameters": [ |