Chromium Code Reviews| 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": [ "events", "tabs" ], | 9 "dependencies": [ "events", "tabs" ], |
| 10 "types": [ | 10 "types": [ |
| 11 { | 11 { |
| 12 "id": "MessageSender", | 12 "id": "MessageSender", |
| 13 "type": "object", | 13 "type": "object", |
| 14 "description": "An object containing information about the script contex t that sent a message or request.", | 14 "description": "An object containing information about the script contex t that sent a message or request.", |
| 15 "properties": { | 15 "properties": { |
| 16 "tab": {"$ref": "tabs.Tab", "optional": true, "description":"This prop erty will <b>only</b> be present when the connection was opened from a tab or co ntent script."}, | 16 "tab": {"$ref": "tabs.Tab", "optional": true, "description":"This prop erty will <b>only</b> be present when the connection was opened from a tab or co ntent script."}, |
| 17 "id": {"type": "string", "description": "The extension ID of the exten sion that opened the connection."} | 17 "id": {"type": "string", "description": "The extension ID of the exten sion that opened the connection."} |
| 18 } | 18 } |
| 19 }, | |
|
not at google - send to devlin
2013/01/03 18:10:56
I don't think these actually need to be around sti
asargent_no_longer_on_chrome
2013/01/03 22:42:27
Yeah, I guess we should remove them if we don't ne
not at google - send to devlin
2013/01/04 22:22:02
Yeah I think that was enough.
Even so I'll make s
| |
| 20 { | |
| 21 "id": "Port", | |
| 22 "nodoc": true, | |
| 23 "type": "object", | |
| 24 "description": "(Deprecated - use runtime.Port instead) An object which allows two way communication with other pages.", | |
| 25 "properties": { | |
| 26 "name": {"type": "string"}, | |
| 27 "onDisconnect": { "$ref": "events.Event" }, | |
| 28 "onMessage": { "$ref": "events.Event" }, | |
| 29 "postMessage": {"type": "function"}, | |
| 30 "sender": { | |
| 31 "$ref": "MessageSender", | |
| 32 "optional": true, | |
| 33 "description": "This property will <b>only</b> be present on ports p assed to onConnect/onConnectExternal listeners." | |
| 34 } | |
| 35 }, | |
| 36 "additionalProperties": { "type": "any"} | |
| 37 } | 19 } |
| 38 ], | 20 ], |
| 39 "properties": { | 21 "properties": { |
| 40 "lastError": { | 22 "lastError": { |
| 41 "type": "object", | 23 "type": "object", |
| 42 "optional": true, | 24 "optional": true, |
| 43 "unprivileged": true, | 25 "unprivileged": true, |
| 44 "description": "Set for the lifetime of a callback if an ansychronous ex tension api has resulted in an error. If no error has occured lastError will be <var>undefined</var>.", | 26 "description": "Set for the lifetime of a callback if an ansychronous ex tension api has resulted in an error. If no error has occured lastError will be <var>undefined</var>.", |
| 45 "properties": { | 27 "properties": { |
| 46 "message": { "type": "string", "description": "Description of the erro r that has taken place." } | 28 "message": { "type": "string", "description": "Description of the erro r that has taken place." } |
| 47 } | 29 } |
| 48 }, | 30 }, |
| 49 "inIncognitoContext": { | 31 "inIncognitoContext": { |
| 50 "type": "boolean", | 32 "type": "boolean", |
| 51 "optional": true, | 33 "optional": true, |
| 52 "unprivileged": true, | 34 "unprivileged": true, |
| 53 "description": "True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only app lies to extensions with 'split' incognito_behavior." | 35 "description": "True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only app lies to extensions with 'split' incognito_behavior." |
| 54 } | 36 } |
| 55 }, | 37 }, |
| 56 "functions": [ | 38 "functions": [ |
| 57 { | 39 { |
| 58 "name": "connect", | |
| 59 "nodoc": true, | |
| 60 "nocompile": true, | |
| 61 "type": "function", | |
| 62 "unprivileged": true, | |
| 63 "description": "(Deprecated - use runtime.connect) Attempts to connect t o other listeners within the extension (such as the extension's background page) . This is primarily useful for content scripts connecting to their extension pro cesses. Note that this does not connect to any listeners in a content script. Ex tensions may connect to content scripts embedded in tabs via $ref:tabs.connect." , | |
| 64 "parameters": [ | |
| 65 {"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."}, | |
| 66 { | |
| 67 "type": "object", | |
| 68 "name": "connectInfo", | |
| 69 "properties": { | |
| 70 "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for extension processes that are listening for the con nection event." } | |
| 71 }, | |
| 72 "optional": true | |
| 73 } | |
| 74 ], | |
| 75 "returns": { | |
| 76 "$ref": "Port", | |
| 77 "description": "Port through which messages can be sent and received w ith the extension. The port's $ref:extension.Port event is fired if extension do es not exist. " | |
| 78 } | |
| 79 }, | |
| 80 { | |
| 81 "name": "connectNative", | |
| 82 "nodoc": true, | |
| 83 "nocompile": true, | |
| 84 "type": "function", | |
| 85 "description": "(Deprecated - use runtime.connectNative instead) Attempt s to connect a native application in the host machine. The native application mu st have already registered itself in the proper directory.", | |
| 86 "parameters": [ | |
| 87 { | |
| 88 "type": "string", | |
| 89 "name": "appName", | |
| 90 "description": "The name of the registered app to connect to." | |
| 91 }, | |
| 92 { | |
| 93 "name": "connectionMessage", | |
| 94 "description": "The object that will be passed to the registered nat ive app on connection.", | |
| 95 "type": "object", | |
| 96 "additionalProperties": { | |
| 97 "type": "any" | |
| 98 } | |
| 99 } | |
| 100 ], | |
| 101 "returns": { | |
| 102 "$ref": "Port", | |
| 103 "description": "Port through which messages can be sent and received w ith the application" | |
| 104 } | |
| 105 }, | |
| 106 { | |
| 107 "name": "sendRequest", | 40 "name": "sendRequest", |
| 108 "nodoc": true, | 41 "nodoc": true, |
| 109 "type": "function", | 42 "type": "function", |
| 110 "allowAmbiguousOptionalArguments": true, | 43 "allowAmbiguousOptionalArguments": true, |
| 111 "unprivileged": true, | 44 "unprivileged": true, |
| 112 "description": "Deprecated: Please use sendMessage.", | 45 "description": "Deprecated: Please use sendMessage.", |
| 113 "parameters": [ | 46 "parameters": [ |
| 114 {"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."}, | 47 {"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."}, |
| 115 { "type": "any", "name": "request" }, | 48 { "type": "any", "name": "request" }, |
| 116 { | 49 { |
| 117 "type": "function", | 50 "type": "function", |
| 118 "name": "responseCallback", | 51 "name": "responseCallback", |
| 119 "optional": true, | 52 "optional": true, |
| 120 "parameters": [ | 53 "parameters": [ |
| 121 { | 54 { |
| 122 "name": "response", | 55 "name": "response", |
| 123 "type": "any", | 56 "type": "any", |
| 124 "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 $ref:runtime.lastError will be set to the e rror message." | 57 "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 $ref:runtime.lastError will be set to the e rror message." |
| 125 } | 58 } |
| 126 ] | 59 ] |
| 127 } | 60 } |
| 128 ] | 61 ] |
| 129 }, | 62 }, |
| 130 { | 63 { |
| 131 "name": "sendMessage", | |
| 132 "nodoc": true, | |
| 133 "nocompile": true, | |
| 134 "type": "function", | |
| 135 "allowAmbiguousOptionalArguments": true, | |
| 136 "unprivileged": true, | |
| 137 "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 $ref:extension.onMessage event is fired in each exte nsion page of the extension. Note that extensions cannot send messages to conten t scripts using this method. To send messages to content scripts, use $ref:tabs. sendMessage.", | |
| 138 "parameters": [ | |
| 139 {"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."}, | |
| 140 { "type": "any", "name": "message" }, | |
| 141 { | |
| 142 "type": "function", | |
| 143 "name": "responseCallback", | |
| 144 "optional": true, | |
| 145 "parameters": [ | |
| 146 { | |
| 147 "name": "response", | |
| 148 "type": "any", | |
| 149 "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 $ref:runtime.lastError will be set to the e rror message." | |
| 150 } | |
| 151 ] | |
| 152 } | |
| 153 ] | |
| 154 }, | |
| 155 { | |
| 156 "name": "sendNativeMessage", | |
| 157 "nodoc": true, | |
| 158 "nocompile": true, | |
| 159 "type": "function", | |
| 160 "description": "(Deprecated - use runtime.sendNativeMessage) Send a sing le message to a registered native application.", | |
| 161 "parameters": [ | |
| 162 { | |
| 163 "name": "registeredNativeApp", | |
| 164 "description": "The name of the registered native application.", | |
| 165 "type": "string" | |
| 166 }, | |
| 167 { | |
| 168 "name": "message", | |
| 169 "description": "The message that will be passed to the registered na tive application.", | |
| 170 "type": "object", | |
| 171 "additionalProperties": { | |
| 172 "type": "any" | |
| 173 } | |
| 174 }, | |
| 175 { | |
| 176 "type": "function", | |
| 177 "name": "callback", | |
| 178 "optional": true, | |
| 179 "description": "Called with the response from the native application .", | |
| 180 "parameters": [ | |
| 181 { | |
| 182 "name": "nativeResponse", | |
| 183 "type": "object", | |
| 184 "description": "Whatever the native application responds with.", | |
| 185 "additionalProperties": { | |
| 186 "type": "any" | |
| 187 } | |
| 188 } | |
| 189 ] | |
| 190 } | |
| 191 ] | |
| 192 }, | |
| 193 { | |
| 194 "name": "getURL", | 64 "name": "getURL", |
| 195 "type": "function", | 65 "type": "function", |
| 196 "unprivileged": true, | 66 "unprivileged": true, |
| 197 "description": "Converts a relative path within an extension install dir ectory to a fully-qualified URL.", | 67 "description": "Converts a relative path within an extension install dir ectory to a fully-qualified URL.", |
| 198 "parameters": [ | 68 "parameters": [ |
| 199 { | 69 { |
| 200 "type": "string", | 70 "type": "string", |
| 201 "name": "path", | 71 "name": "path", |
| 202 "description": "A path to a resource within an extension expressed r elative to its install directory." | 72 "description": "A path to a resource within an extension expressed r elative to its install directory." |
| 203 } | 73 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 "name": "setUpdateUrlData", | 173 "name": "setUpdateUrlData", |
| 304 "type": "function", | 174 "type": "function", |
| 305 "description": "Sets the value of the ap CGI parameter used in the exten sion's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery.", | 175 "description": "Sets the value of the ap CGI parameter used in the exten sion's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery.", |
| 306 "parameters": [ | 176 "parameters": [ |
| 307 {"type": "string", "name": "data", "maxLength": 1024} | 177 {"type": "string", "name": "data", "maxLength": 1024} |
| 308 ] | 178 ] |
| 309 } | 179 } |
| 310 ], | 180 ], |
| 311 "events": [ | 181 "events": [ |
| 312 { | 182 { |
| 313 "name": "onConnect", | |
| 314 "nodoc": true, | |
| 315 "nocompile": true, | |
| 316 "type": "function", | |
| 317 "unprivileged": true, | |
| 318 "anonymous": true, | |
| 319 "description": "Fired when a connection is made from either an extension process or a content script.", | |
| 320 "parameters": [ | |
| 321 {"$ref": "Port", "name": "port"} | |
| 322 ] | |
| 323 }, | |
| 324 { | |
| 325 "name": "onConnectExternal", | |
| 326 "nodoc": true, | |
| 327 "nocompile": true, | |
| 328 "type": "function", | |
| 329 "anonymous": true, | |
| 330 "description": "Fired when a connection is made from another extension." , | |
| 331 "parameters": [ | |
| 332 {"$ref": "Port", "name": "port"} | |
| 333 ] | |
| 334 }, | |
| 335 { | |
| 336 "name": "onRequest", | 183 "name": "onRequest", |
| 337 "nodoc": true, | 184 "nodoc": true, |
| 338 "type": "function", | 185 "type": "function", |
| 339 "anonymous": true, | 186 "anonymous": true, |
| 340 "unprivileged": true, | 187 "unprivileged": true, |
| 341 "description": "Deprecated: please use onMessage.", | 188 "description": "Deprecated: please use onMessage.", |
| 342 "parameters": [ | 189 "parameters": [ |
| 343 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, | 190 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, |
| 344 {"name": "sender", "$ref": "MessageSender" }, | 191 {"name": "sender", "$ref": "MessageSender" }, |
| 345 {"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." } | 192 {"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." } |
| 346 ] | 193 ] |
| 347 }, | 194 }, |
| 348 { | 195 { |
| 349 "name": "onRequestExternal", | 196 "name": "onRequestExternal", |
| 350 "nodoc": true, | 197 "nodoc": true, |
| 351 "type": "function", | 198 "type": "function", |
| 352 "anonymous": true, | 199 "anonymous": true, |
| 353 "description": "Deprecated: please use onMessageExternal.", | 200 "description": "Deprecated: please use onMessageExternal.", |
| 354 "parameters": [ | 201 "parameters": [ |
| 355 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, | 202 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, |
| 356 {"name": "sender", "$ref": "MessageSender" }, | 203 {"name": "sender", "$ref": "MessageSender" }, |
| 357 {"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." } | 204 {"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." } |
| 358 ] | 205 ] |
| 359 }, | |
| 360 { | |
| 361 "name": "onMessage", | |
| 362 "nodoc": true, | |
| 363 "nocompile": true, | |
| 364 "type": "function", | |
| 365 "anonymous": true, | |
| 366 "unprivileged": true, | |
| 367 "description": "(Deprecated - use runtime.onMessage instead) Fired when a message is sent from either an extension process or a content script.", | |
| 368 "parameters": [ | |
| 369 {"name": "message", "type": "any", "description": "The message sent by the calling script."}, | |
| 370 {"name": "sender", "$ref": "MessageSender" }, | |
| 371 {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON -ifiable object. If you have more than one <code>onMessage</code> listener in th e same document, then only one may send a response. This function becomes invali d when the event listener returns, unless you return true from the event listene r to indicate you wish to send a response asynchronously (this will keep the mes sage channel open to the other end until <code>sendResponse</code> is called)." } | |
| 372 ], | |
| 373 "returns": { | |
| 374 "type": "boolean", | |
| 375 "optional": "true", | |
| 376 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns." | |
| 377 } | |
| 378 }, | |
| 379 { | |
| 380 "name": "onMessageExternal", | |
| 381 "nodoc": true, | |
| 382 "nocompile": true, | |
| 383 "type": "function", | |
| 384 "anonymous": true, | |
| 385 "description": "(Deprecated - use runtime.onMessageExternal instead) Fir ed when a message is sent from another extension. Cannot be used in a content sc ript.", | |
| 386 "parameters": [ | |
| 387 {"name": "message", "type": "any", "description": "The message sent by the calling script."}, | |
| 388 {"name": "sender", "$ref": "MessageSender" }, | |
| 389 {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON -ifiable object. If you have more than one <code>onMessage</code> listener in th e same document, then only one may send a response. This function becomes invali d when the event listener returns, unless you return true from the event listene r to indicate you wish to send a response asynchronously (this will keep the mes sage channel open to the other end until <code>sendResponse</code> is called)." } | |
| 390 ], | |
| 391 "returns": { | |
| 392 "type": "boolean", | |
| 393 "optional": "true", | |
| 394 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns." | |
| 395 } | |
| 396 } | 206 } |
| 397 ] | 207 ] |
| 398 } | 208 } |
| 399 ] | 209 ] |
| OLD | NEW |