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 // Note: Many of these functions and events are implemented by hand and should |
| 6 // not elicit any code generation from the schema compiler. These items are |
| 7 // marked "nocompile." |
5 [ | 8 [ |
6 { | 9 { |
7 "namespace": "runtime", | 10 "namespace": "runtime", |
8 "description": "Use the <code>chrome.runtime</code> API to retrieve the back
ground page, return details about the manifest, and listen for and respond to ev
ents in the app or extension lifecycle. You can also use this API to convert the
relative path of URLs to fully-qualified URLs.", | 11 "description": "Use the <code>chrome.runtime</code> API to retrieve the back
ground page, return details about the manifest, and listen for and respond to ev
ents in the app or extension lifecycle. You can also use this API to convert the
relative path of URLs to fully-qualified URLs.", |
9 "types": [ | 12 "types": [ |
10 { | 13 { |
11 "id": "Port", | 14 "id": "Port", |
12 "type": "object", | 15 "type": "object", |
13 "nocompile": true, | 16 "nocompile": true, |
14 "description": "An object which allows two way communication with other
pages.", | 17 "description": "An object which allows two way communication with other
pages.", |
15 "properties": { | 18 "properties": { |
16 "name": {"type": "string"}, | 19 "name": {"type": "string"}, |
17 "disconnect": { "type": "function" }, | 20 "disconnect": { "type": "function" }, |
18 "onDisconnect": { "$ref": "events.Event" }, | 21 "onDisconnect": { "$ref": "events.Event" }, |
19 "onMessage": { "$ref": "events.Event" }, | 22 "onMessage": { "$ref": "events.Event" }, |
20 "postMessage": {"type": "function"}, | 23 "postMessage": {"type": "function"}, |
21 "sender": { | 24 "sender": { |
22 "$ref": "MessageSender", | 25 "$ref": "MessageSender", |
23 "optional": true, | 26 "optional": true, |
24 "description": "This property will <b>only</b> be present on ports p
assed to onConnect/onConnectExternal listeners." | 27 "description": "This property will <b>only</b> be present on ports p
assed to onConnect/onConnectExternal listeners." |
25 } | 28 } |
26 }, | 29 }, |
27 "additionalProperties": { "type": "any"} | 30 "additionalProperties": { "type": "any"} |
28 }, | 31 }, |
29 { | 32 { |
30 "id": "MessageSender", | 33 "id": "MessageSender", |
31 "type": "object", | 34 "type": "object", |
| 35 "nocompile": true, |
32 "description": "An object containing information about the script contex
t that sent a message or request.", | 36 "description": "An object containing information about the script contex
t that sent a message or request.", |
33 "properties": { | 37 "properties": { |
34 "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $(re
f:tabs.Tab) which opened the connection, if any. This property will <strong>only
</strong> be present when the connection was opened from a tab (including conten
t scripts), and <strong>only</strong> if the receiver is an extension, not an ap
p."}, | 38 "tab": {"$ref": "tabs.Tab", "optional": true, "description": "The $(re
f:tabs.Tab) which opened the connection, if any. This property will <strong>only
</strong> be present when the connection was opened from a tab (including conten
t scripts), and <strong>only</strong> if the receiver is an extension, not an ap
p."}, |
35 "id": {"type": "string", "optional": true, "description": "The ID of t
he extension or app that opened the connection, if any."}, | 39 "id": {"type": "string", "optional": true, "description": "The ID of t
he extension or app that opened the connection, if any."}, |
36 "url": {"type": "string", "optional": true, "description": "The URL of
the page or frame that opened the connection, if any. This property will <stron
g>only</strong> be present when the connection was opened from a tab or content
script."}, | 40 "url": {"type": "string", "optional": true, "description": "The URL of
the page or frame that opened the connection, if any. This property will <stron
g>only</strong> be present when the connection was opened from a tab or content
script."}, |
37 "tlsChannelId": {"type": "string", "optional": true, "description": "T
he TLS channel ID of the web page that opened the connection, if requested by th
e extension or app, and if available."} | 41 "tlsChannelId": {"type": "string", "optional": true, "description": "T
he TLS channel ID of the web page that opened the connection, if requested by th
e extension or app, and if available."} |
38 } | 42 } |
| 43 }, |
| 44 { |
| 45 "id": "PlatformInfo", |
| 46 "type": "object", |
| 47 "description": "An object containing information about the current platf
orm.", |
| 48 "properties": { |
| 49 "os": { |
| 50 "type": "string", |
| 51 "description": "The operating system chrome is running on.", |
| 52 "enum": ["mac", "win", "android", "cros", "linux", "openbsd"] |
| 53 }, |
| 54 "arch": { |
| 55 "type": "string", |
| 56 "enum": ["arm", "x86-32", "x86-64"], |
| 57 "description": "The machine's processor architecture." |
| 58 }, |
| 59 "nacl_arch" : { |
| 60 "description": "The native client architecture. This may be differen
t from arch on some platforms.", |
| 61 "type": "string", |
| 62 "enum": ["arm", "x86-32", "x86-64"] |
| 63 } |
| 64 } |
39 } | 65 } |
40 ], | 66 ], |
41 "properties": { | 67 "properties": { |
42 "lastError": { | 68 "lastError": { |
43 "type": "object", | 69 "type": "object", |
44 "optional": true, | 70 "optional": true, |
45 "description": "This will be defined during an API method callback if th
ere was an error", | 71 "description": "This will be defined during an API method callback if th
ere was an error", |
46 "properties": { | 72 "properties": { |
47 "message": { | 73 "message": { |
48 "optional": true, | 74 "optional": true, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 "type": "function", | 302 "type": "function", |
277 "description": "Returns information about the current platform.", | 303 "description": "Returns information about the current platform.", |
278 "parameters": [ | 304 "parameters": [ |
279 { | 305 { |
280 "type": "function", | 306 "type": "function", |
281 "name": "callback", | 307 "name": "callback", |
282 "description": "Called with results", | 308 "description": "Called with results", |
283 "parameters": [ | 309 "parameters": [ |
284 { | 310 { |
285 "name": "platformInfo", | 311 "name": "platformInfo", |
286 "type": "object", | 312 "$ref": "PlatformInfo" |
287 "properties": { | |
288 "os": { | |
289 "type": "string", | |
290 "description": "The operating system chrome is running on.", | |
291 "enum": ["mac", "win", "android", "cros", "linux", "openbsd"
] | |
292 }, | |
293 "arch": { | |
294 "type": "string", | |
295 "enum": ["arm", "x86-32", "x86-64"], | |
296 "description": "The machine's processor architecture." | |
297 }, | |
298 "nacl_arch" : { | |
299 "description": "The native client architecture. This may be
different from arch on some platforms.", | |
300 "type": "string", | |
301 "enum": ["arm", "x86-32", "x86-64"] | |
302 } | |
303 } | |
304 } | 313 } |
305 ] | 314 ] |
306 } | 315 } |
307 ] | 316 ] |
308 }, | 317 }, |
309 { | 318 { |
310 "name": "getPackageDirectoryEntry", | 319 "name": "getPackageDirectoryEntry", |
311 "type": "function", | 320 "type": "function", |
312 "description": "Returns a DirectoryEntry for the package directory.", | 321 "description": "Returns a DirectoryEntry for the package directory.", |
313 "parameters": [ | 322 "parameters": [ |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 "parameters": [ | 425 "parameters": [ |
417 {"$ref": "Port", "name": "port"} | 426 {"$ref": "Port", "name": "port"} |
418 ] | 427 ] |
419 }, | 428 }, |
420 { | 429 { |
421 "name": "onMessage", | 430 "name": "onMessage", |
422 "type": "function", | 431 "type": "function", |
423 "options": { | 432 "options": { |
424 "unmanaged": true | 433 "unmanaged": true |
425 }, | 434 }, |
| 435 "nocompile": true, |
426 "description": "Fired when a message is sent from either an extension pr
ocess or a content script.", | 436 "description": "Fired when a message is sent from either an extension pr
ocess or a content script.", |
427 "parameters": [ | 437 "parameters": [ |
428 {"name": "message", "type": "any", "optional": true, "description": "T
he message sent by the calling script."}, | 438 {"name": "message", "type": "any", "optional": true, "description": "T
he message sent by the calling script."}, |
429 {"name": "sender", "$ref": "MessageSender" }, | 439 {"name": "sender", "$ref": "MessageSender" }, |
430 {"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)."
} | 440 {"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)."
} |
431 ], | 441 ], |
432 "returns": { | 442 "returns": { |
433 "type": "boolean", | 443 "type": "boolean", |
434 "optional": true, | 444 "optional": true, |
435 "description": "Return true from the event listener if you wish to cal
l <code>sendResponse</code> after the event listener returns." | 445 "description": "Return true from the event listener if you wish to cal
l <code>sendResponse</code> after the event listener returns." |
436 } | 446 } |
437 }, | 447 }, |
438 { | 448 { |
439 "name": "onMessageExternal", | 449 "name": "onMessageExternal", |
440 "type": "function", | 450 "type": "function", |
441 "options": { | 451 "options": { |
442 "unmanaged": true | 452 "unmanaged": true |
443 }, | 453 }, |
| 454 "nocompile": true, |
444 "description": "Fired when a message is sent from another extension/app.
Cannot be used in a content script.", | 455 "description": "Fired when a message is sent from another extension/app.
Cannot be used in a content script.", |
445 "parameters": [ | 456 "parameters": [ |
446 {"name": "message", "type": "any", "optional": true, "description": "T
he message sent by the calling script."}, | 457 {"name": "message", "type": "any", "optional": true, "description": "T
he message sent by the calling script."}, |
447 {"name": "sender", "$ref": "MessageSender" }, | 458 {"name": "sender", "$ref": "MessageSender" }, |
448 {"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)."
} | 459 {"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)."
} |
449 ], | 460 ], |
450 "returns": { | 461 "returns": { |
451 "type": "boolean", | 462 "type": "boolean", |
452 "optional": true, | 463 "optional": true, |
453 "description": "Return true from the event listener if you wish to cal
l <code>sendResponse</code> after the event listener returns." | 464 "description": "Return true from the event listener if you wish to cal
l <code>sendResponse</code> after the event listener returns." |
454 } | 465 } |
455 }, | 466 }, |
456 { | 467 { |
457 "name": "onRestartRequired", | 468 "name": "onRestartRequired", |
458 "type": "function", | 469 "type": "function", |
459 "description": "Fired when an app or the device that it runs on needs to
be restarted. The app should close all its windows at its earliest convenient t
ime to let the restart to happen. If the app does nothing, a restart will be enf
orced after a 24-hour grace period has passed. Currently, this event is only fir
ed for Chrome OS kiosk apps.", | 470 "description": "Fired when an app or the device that it runs on needs to
be restarted. The app should close all its windows at its earliest convenient t
ime to let the restart to happen. If the app does nothing, a restart will be enf
orced after a 24-hour grace period has passed. Currently, this event is only fir
ed for Chrome OS kiosk apps.", |
460 "parameters": [ | 471 "parameters": [ |
461 { | 472 { |
462 "type": "string", | 473 "type": "string", |
463 "name": "reason", | 474 "name": "reason", |
464 "description": "The reason that the event is being dispatched. 'app_
update' is used when the restart is needed because the application is updated to
a newer version. 'os_update' is used when the restart is needed because the bro
wser/OS is updated to a newer version. 'periodic' is used when the system runs f
or more than the permitted uptime set in the enterprise policy.", | 475 "description": "The reason that the event is being dispatched. 'app_
update' is used when the restart is needed because the application is updated to
a newer version. 'os_update' is used when the restart is needed because the bro
wser/OS is updated to a newer version. 'periodic' is used when the system runs f
or more than the permitted uptime set in the enterprise policy.", |
465 "enum": ["app_update", "os_update", "periodic"] | 476 "enum": ["app_update", "os_update", "periodic"] |
466 } | 477 } |
467 ] | 478 ] |
468 } | 479 } |
469 ] | 480 ] |
470 } | 481 } |
471 ] | 482 ] |
OLD | NEW |