OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [ | 5 [ |
6 { | 6 { |
7 "namespace": "extension", | 7 "namespace": "extension", |
8 "nocompile": true, | 8 "nocompile": true, |
9 "dependencies": [ "tabs" ], | 9 "dependencies": [ "tabs" ], |
10 "types": [ | 10 "types": [ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 "returns": { | 84 "returns": { |
85 "$ref": "Port", | 85 "$ref": "Port", |
86 "description": "Port through which messages can be sent and received w
ith the extension. The port's <a href='extension.html#type-Port'>onDisconnect</a
> event is fired if extension does not exist. " | 86 "description": "Port through which messages can be sent and received w
ith the extension. The port's <a href='extension.html#type-Port'>onDisconnect</a
> event is fired if extension does not exist. " |
87 } | 87 } |
88 }, | 88 }, |
89 { | 89 { |
90 "name": "sendRequest", | 90 "name": "sendRequest", |
91 "type": "function", | 91 "type": "function", |
92 "allowAmbiguousOptionalArguments": true, | 92 "allowAmbiguousOptionalArguments": true, |
93 "unprivileged": true, | 93 "unprivileged": true, |
94 "description": "Sends a single request to other listeners within the ext
ension. Similar to chrome.extension.connect, but only sends a single request wit
h an optional response. The <a href='extension.html#event-onRequest'>chrome.exte
nsion.onRequest</a> event is fired in each page of the extension.", | 94 "description": "Deprecated: Please use sendMessage.", |
95 "parameters": [ | 95 "parameters": [ |
96 {"type": "string", "name": "extensionId", "optional": true, "descripti
on": "The extension ID of the extension you want to connect to. If omitted, defa
ult is your own extension."}, | 96 {"type": "string", "name": "extensionId", "optional": true, "descripti
on": "The extension ID of the extension you want to connect to. If omitted, defa
ult is your own extension."}, |
97 { "type": "any", "name": "request" }, | 97 { "type": "any", "name": "request" }, |
98 { | 98 { |
99 "type": "function", | 99 "type": "function", |
100 "name": "responseCallback", | 100 "name": "responseCallback", |
101 "optional": true, | 101 "optional": true, |
102 "parameters": [ | 102 "parameters": [ |
103 { | 103 { |
104 "name": "response", | 104 "name": "response", |
105 "type": "any", | 105 "type": "any", |
106 "description": "The JSON response object sent by the handler of
the request. If an error occurs while connecting to the extension, the callback
will be called with no arguments and <a href='extension.html#property-lastError'
>chrome.extension.lastError</a> will be set to the error message." | 106 "description": "The JSON response object sent by the handler of
the request. If an error occurs while connecting to the extension, the callback
will be called with no arguments and <a href='extension.html#property-lastError'
>chrome.extension.lastError</a> will be set to the error message." |
107 } | 107 } |
108 ] | 108 ] |
109 } | 109 } |
110 ] | 110 ] |
111 }, | 111 }, |
112 { | 112 { |
| 113 "name": "sendMessage", |
| 114 "type": "function", |
| 115 "allowAmbiguousOptionalArguments": true, |
| 116 "unprivileged": true, |
| 117 "description": "Sends a single message to other listeners within the ext
ension. Similar to chrome.extension.connect, but only sends a single message wit
h an optional response. The <a href='extension.html#event-onMessage'>chrome.exte
nsion.onMessage</a> event is fired in each page of the extension.", |
| 118 "parameters": [ |
| 119 {"type": "string", "name": "extensionId", "optional": true, "descripti
on": "The extension ID of the extension you want to connect to. If omitted, defa
ult is your own extension."}, |
| 120 { "type": "any", "name": "message" }, |
| 121 { |
| 122 "type": "function", |
| 123 "name": "responseCallback", |
| 124 "optional": true, |
| 125 "parameters": [ |
| 126 { |
| 127 "name": "response", |
| 128 "type": "any", |
| 129 "description": "The JSON response object sent by the handler of
the message. If an error occurs while connecting to the extension, the callback
will be called with no arguments and <a href='extension.html#property-lastError'
>chrome.extension.lastError</a> will be set to the error message." |
| 130 } |
| 131 ] |
| 132 } |
| 133 ] |
| 134 }, |
| 135 { |
113 "name": "getURL", | 136 "name": "getURL", |
114 "type": "function", | 137 "type": "function", |
115 "unprivileged": true, | 138 "unprivileged": true, |
116 "description": "Converts a relative path within an extension install dir
ectory to a fully-qualified URL.", | 139 "description": "Converts a relative path within an extension install dir
ectory to a fully-qualified URL.", |
117 "parameters": [ | 140 "parameters": [ |
118 { | 141 { |
119 "type": "string", | 142 "type": "string", |
120 "name": "path", | 143 "name": "path", |
121 "description": "A path to a resource within an extension expressed r
elative to its install directory." | 144 "description": "A path to a resource within an extension expressed r
elative to its install directory." |
122 } | 145 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 "description": "Fired when a connection is made from another extension."
, | 268 "description": "Fired when a connection is made from another extension."
, |
246 "parameters": [ | 269 "parameters": [ |
247 {"$ref": "Port", "name": "port"} | 270 {"$ref": "Port", "name": "port"} |
248 ] | 271 ] |
249 }, | 272 }, |
250 { | 273 { |
251 "name": "onRequest", | 274 "name": "onRequest", |
252 "type": "function", | 275 "type": "function", |
253 "anonymous": true, | 276 "anonymous": true, |
254 "unprivileged": true, | 277 "unprivileged": true, |
255 "description": "Fired when a request is sent from either an extension pr
ocess or a content script.", | 278 "description": "Deprecated: please use onMessage.", |
256 "parameters": [ | 279 "parameters": [ |
257 {"name": "request", "type": "any", "description": "The request sent by
the calling script."}, | 280 {"name": "request", "type": "any", "description": "The request sent by
the calling script."}, |
258 {"name": "sender", "$ref": "MessageSender" }, | 281 {"name": "sender", "$ref": "MessageSender" }, |
259 {"name": "sendResponse", "type": "function", "description": "Function
to call (at most once) when you have a response. The argument should be any JSON
-ifiable object, or undefined if there is no response. If you have more than one
<code>onRequest</code> listener in the same document, then only one may send a
response." } | 282 {"name": "sendResponse", "type": "function", "description": "Function
to call (at most once) when you have a response. The argument should be any JSON
-ifiable object, or undefined if there is no response. If you have more than one
<code>onRequest</code> listener in the same document, then only one may send a
response." } |
260 ] | 283 ] |
261 }, | 284 }, |
262 { | 285 { |
263 "name": "onRequestExternal", | 286 "name": "onRequestExternal", |
264 "type": "function", | 287 "type": "function", |
265 "anonymous": true, | 288 "anonymous": true, |
266 "description": "Fired when a request is sent from another extension.", | 289 "description": "Deprecated: please use onMessageExternal.", |
267 "parameters": [ | 290 "parameters": [ |
268 {"name": "request", "type": "any", "description": "The request sent by
the calling script."}, | 291 {"name": "request", "type": "any", "description": "The request sent by
the calling script."}, |
269 {"name": "sender", "$ref": "MessageSender" }, | 292 {"name": "sender", "$ref": "MessageSender" }, |
270 {"name": "sendResponse", "type": "function", "description": "Function
to call when you have a response. The argument should be any JSON-ifiable object
, or undefined if there is no response." } | 293 {"name": "sendResponse", "type": "function", "description": "Function
to call when you have a response. The argument should be any JSON-ifiable object
, or undefined if there is no response." } |
271 ] | 294 ] |
| 295 }, |
| 296 { |
| 297 "name": "onMessage", |
| 298 "type": "function", |
| 299 "anonymous": true, |
| 300 "unprivileged": true, |
| 301 "description": "Fired when a message is sent from either an extension pr
ocess or a content script.", |
| 302 "parameters": [ |
| 303 { |
| 304 "name": "details", |
| 305 "type": "object", |
| 306 "properties": { |
| 307 "message": { "type": "any", "description": "The message sent by th
e calling script."}, |
| 308 "sender": { "$ref": "MessageSender" }, |
| 309 "sendResponse": { "type": "function", "description": "Function to
call (at most once) when you have a response. The argument should be any JSON-if
iable object, or undefined if there is no response. If you have more than one <c
ode>onMessage</code> listener in the same document, then only one may send a res
ponse. Note: accessing this property will keep the port open until you call the
function, so don't access it unless you plan on calling it." } |
| 310 } |
| 311 } |
| 312 ] |
| 313 }, |
| 314 { |
| 315 "name": "onMessageExternal", |
| 316 "type": "function", |
| 317 "anonymous": true, |
| 318 "description": "Fired when a message is sent from another extension.", |
| 319 "parameters": [ |
| 320 { |
| 321 "name": "details", |
| 322 "type": "object", |
| 323 "properties": { |
| 324 "message": { "type": "any", "description": "The message sent by th
e calling script."}, |
| 325 "sender": { "$ref": "MessageSender" }, |
| 326 "sendResponse": { "type": "function", "description": "Function to
call (at most once) when you have a response. The argument should be any JSON-if
iable object, or undefined if there is no response. If you have more than one <c
ode>onMessage</code> listener in the same document, then only one may send a res
ponse. Note: accessing this property will keep the port open until you call the
function, so don't access it unless you plan on calling it." } |
| 327 } |
| 328 } |
| 329 ] |
272 } | 330 } |
273 ] | 331 ] |
274 } | 332 } |
275 ] | 333 ] |
OLD | NEW |