Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/common/extensions/api/runtime.json

Issue 264743014: Move chrome.runtime to //extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: prevent runtime impl from handling invalid update versions Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 [
6 {
7 "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.",
9 "types": [
10 {
11 "id": "Port",
12 "type": "object",
13 "nocompile": true,
14 "description": "An object which allows two way communication with other pages.",
15 "properties": {
16 "name": {"type": "string"},
17 "disconnect": { "type": "function" },
18 "onDisconnect": { "$ref": "events.Event" },
19 "onMessage": { "$ref": "events.Event" },
20 "postMessage": {"type": "function"},
21 "sender": {
22 "$ref": "MessageSender",
23 "optional": true,
24 "description": "This property will <b>only</b> be present on ports p assed to onConnect/onConnectExternal listeners."
25 }
26 },
27 "additionalProperties": { "type": "any"}
28 },
29 {
30 "id": "MessageSender",
31 "type": "object",
32 "description": "An object containing information about the script contex t that sent a message or request.",
33 "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."},
35 "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."},
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."}
38 }
39 }
40 ],
41 "properties": {
42 "lastError": {
43 "type": "object",
44 "optional": true,
45 "description": "This will be defined during an API method callback if th ere was an error",
46 "properties": {
47 "message": {
48 "optional": true,
49 "type": "string",
50 "description": "Details about the error which occurred."
51 }
52 }
53 },
54 "id": {
55 "type": "string",
56 "description": "The ID of the extension/app."
57 }
58 },
59 "functions": [
60 {
61 "name": "getBackgroundPage",
62 "type": "function",
63 "description": "Retrieves the JavaScript 'window' object for the backgro und page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.",
64 "parameters": [
65 {
66 "type": "function",
67 "name": "callback",
68 "parameters": [
69 {
70 "name": "backgroundPage",
71 // Note: Only optional because we don't support validation
72 // for custom callbacks.
73 "optional": true,
74 "type": "object",
75 "isInstanceOf": "Window",
76 "additionalProperties": { "type": "any" },
77 "description": "The JavaScript 'window' object for the backgroun d page."
78 }
79 ]
80 }
81 ]
82 },
83 {
84 "name": "getManifest",
85 "description": "Returns details about the app or extension from the mani fest. The object returned is a serialization of the full <a href=\"manifest.html \">manifest file</a>.",
86 "type": "function",
87 "nocompile": true,
88 "parameters": [],
89 "returns": {
90 "type": "object",
91 "properties": {},
92 "additionalProperties": { "type": "any" },
93 "description": "The manifest details."
94 }
95 },
96 {
97 "name": "getURL",
98 "type": "function",
99 "nocompile": true,
100 "description": "Converts a relative path within an app/extension install directory to a fully-qualified URL.",
101 "parameters": [
102 {
103 "type": "string",
104 "name": "path",
105 "description": "A path to a resource within an app/extension express ed relative to its install directory."
106 }
107 ],
108 "returns": {
109 "type": "string",
110 "description": "The fully-qualified URL to the resource."
111 }
112 },
113 {
114 "name": "setUninstallURL",
115 "type": "function",
116 "description": "Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maxi mum 255 characters.",
117 "parameters": [
118 {
119 "type": "string",
120 "name": "url",
121 "maxLength": 255
122 }
123 ]
124 },
125 {
126 "name": "reload",
127 "description": "Reloads the app or extension.",
128 "type": "function",
129 "parameters": []
130 },
131 {
132 "name": "requestUpdateCheck",
133 "type": "function",
134 "description": "Requests an update check for this app/extension.",
135 "parameters": [
136 {
137 "type": "function",
138 "name": "callback",
139 "parameters": [
140 {
141 "name": "status",
142 "type": "string",
143 "enum": ["throttled", "no_update", "update_available"],
144 "description": "Result of the update check."
145 },
146 {
147 "name": "details",
148 "type": "object",
149 "optional": true,
150 "properties": {
151 "version": {
152 "type": "string",
153 "description": "The version of the available update."
154 }
155 },
156 "description": "If an update is available, this contains more in formation about the available update."
157 }
158 ]
159 }
160 ]
161 },
162 {
163 "name": "restart",
164 "description": "Restart the ChromeOS device when the app runs in kiosk m ode. Otherwise, it's no-op.",
165 "type": "function",
166 "parameters": []
167 },
168 {
169 "name": "connect",
170 "type": "function",
171 "nocompile": true,
172 "description": "Attempts to connect to connect listeners within an exten sion/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extensio n communication, and <a href=\"manifest/externally_connectable.html\">web messag ing</a>. Note that this does not connect to any listeners in a content script. E xtensions may connect to content scripts embedded in tabs via $(ref:tabs.connect ).",
173 "parameters": [
174 {"type": "string", "name": "extensionId", "optional": true, "descripti on": "The ID of the extension or app to connect to. If omitted, a connection wil l be attempted with your own extension. Required if sending messages from a web page for <a href=\"manifest/externally_connectable.html\">web messaging</a>."},
175 {
176 "type": "object",
177 "name": "connectInfo",
178 "properties": {
179 "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for processes that are listening for the connection ev ent." },
180 "includeTlsChannelId": { "type": "boolean", "optional": true, "des cription": "Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event." }
181 },
182 "optional": true
183 }
184 ],
185 "returns": {
186 "$ref": "Port",
187 "description": "Port through which messages can be sent and received. The port's $(ref:runtime.Port onDisconnect) event is fired if the extension/app does not exist. "
188 }
189 },
190 {
191 "name": "connectNative",
192 "type": "function",
193 "nocompile": true,
194 "description": "Connects to a native application in the host machine.",
195 "parameters": [
196 {
197 "type": "string",
198 "name": "application",
199 "description": "The name of the registered application to connect to ."
200 }
201 ],
202 "returns": {
203 "$ref": "Port",
204 "description": "Port through which messages can be sent and received w ith the application"
205 }
206 },
207 {
208 "name": "sendMessage",
209 "type": "function",
210 "nocompile": true,
211 "allowAmbiguousOptionalArguments": true,
212 "description": "Sends a single message to event listeners within your ex tension/app or a different extension/app. Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. If sending to your exten sion, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:ru ntime.onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $(ref:tabs.sendMessage).",
213 "parameters": [
214 {"type": "string", "name": "extensionId", "optional": true, "descripti on": "The ID of the extension/app to send the message to. If omitted, the messag e will be sent to your own extension/app. Required if sending messages from a we b page for <a href=\"manifest/externally_connectable.html\">web messaging</a>."} ,
215 { "type": "any", "name": "message" },
216 {
217 "type": "object",
218 "name": "options",
219 "properties": {
220 "includeTlsChannelId": { "type": "boolean", "optional": true, "des cription": "Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event." }
221 },
222 "optional": true
223 },
224 {
225 "type": "function",
226 "name": "responseCallback",
227 "optional": true,
228 "parameters": [
229 {
230 "name": "response",
231 "type": "any",
232 "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 error message."
233 }
234 ]
235 }
236 ]
237 },
238 {
239 "name": "sendNativeMessage",
240 "type": "function",
241 "nocompile": true,
242 "description": "Send a single message to a native application.",
243 "parameters": [
244 {
245 "name": "application",
246 "description": "The name of the native messaging host.",
247 "type": "string"
248 },
249 {
250 "name": "message",
251 "description": "The message that will be passed to the native messag ing host.",
252 "type": "object",
253 "additionalProperties": {
254 "type": "any"
255 }
256 },
257 {
258 "type": "function",
259 "name": "responseCallback",
260 "optional": true,
261 "parameters": [
262 {
263 "name": "response",
264 "type": "any",
265 "description": "The response message sent by the native messagin g host. If an error occurs while connecting to the native messaging host, the ca llback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message.",
266 "additionalProperties": {
267 "type": "any"
268 }
269 }
270 ]
271 }
272 ]
273 },
274 {
275 "name": "getPlatformInfo",
276 "type": "function",
277 "description": "Returns information about the current platform.",
278 "parameters": [
279 {
280 "type": "function",
281 "name": "callback",
282 "description": "Called with results",
283 "parameters": [
284 {
285 "name": "platformInfo",
286 "type": "object",
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 }
305 ]
306 }
307 ]
308 },
309 {
310 "name": "getPackageDirectoryEntry",
311 "type": "function",
312 "description": "Returns a DirectoryEntry for the package directory.",
313 "parameters": [
314 {
315 "type": "function",
316 "name": "callback",
317 "parameters": [
318 {
319 "name": "directoryEntry",
320 "type": "object",
321 "additionalProperties": { "type": "any" },
322 "isInstanceOf": "DirectoryEntry"
323 }
324 ]
325 }
326 ]
327 }
328 ],
329 "events": [
330 {
331 "name": "onStartup",
332 "type": "function",
333 "description": "Fired when a profile that has this extension installed f irst starts up. This event is not fired when an incognito profile is started, ev en if this extension is operating in 'split' incognito mode."
334 },
335 {
336 "name": "onInstalled",
337 "type": "function",
338 "description": "Fired when the extension is first installed, when the ex tension is updated to a new version, and when Chrome is updated to a new version .",
339 "parameters": [
340 {
341 "type": "object",
342 "name": "details",
343 "properties": {
344 "reason": {
345 "type": "string",
346 "enum": ["install", "update", "chrome_update"],
347 "description": "The reason that this event is being dispatched."
348 },
349 "previousVersion": {
350 "type": "string",
351 "optional": true,
352 "description": "Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'."
353 }
354 }
355 }
356 ]
357 },
358 {
359 "name": "onSuspend",
360 "type": "function",
361 "description": "Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are no t guaranteed to complete. If more activity for the event page occurs before it g ets unloaded the onSuspendCanceled event will be sent and the page won't be unlo aded. "
362 },
363 {
364 "name": "onSuspendCanceled",
365 "type": "function",
366 "description": "Sent after onSuspend to indicate that the app won't be u nloaded after all."
367 },
368 {
369 "name": "onUpdateAvailable",
370 "type": "function",
371 "description": "Fired when an update is available, but isn't installed i mmediately because the app is currently running. If you do nothing, the update w ill be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload().",
372 "parameters": [
373 {
374 "type": "object",
375 "name": "details",
376 "properties": {
377 "version": {
378 "type": "string",
379 "description": "The version number of the available update."
380 }
381 },
382 "additionalProperties": { "type": "any" },
383 "description": "The manifest details of the available update."
384 }
385 ]
386 },
387 {
388 // TODO(xiyuan): onBrowserUpdateAvailable is deprecated in favor of
389 // onRestartRequired. We should remove it when we are sure it is unused.
390 "name": "onBrowserUpdateAvailable",
391 "type": "function",
392 "description": "Fired when a Chrome update is available, but isn't insta lled immediately because a browser restart is required.",
393 "deprecated": "Please use $(ref:runtime.onRestartRequired).",
394 "parameters": []
395 },
396 {
397 "name": "onConnect",
398 "type": "function",
399 "nocompile": true,
400 "options": {
401 "unmanaged": true
402 },
403 "description": "Fired when a connection is made from either an extension process or a content script.",
404 "parameters": [
405 {"$ref": "Port", "name": "port"}
406 ]
407 },
408 {
409 "name": "onConnectExternal",
410 "type": "function",
411 "nocompile": true,
412 "options": {
413 "unmanaged": true
414 },
415 "description": "Fired when a connection is made from another extension." ,
416 "parameters": [
417 {"$ref": "Port", "name": "port"}
418 ]
419 },
420 {
421 "name": "onMessage",
422 "type": "function",
423 "options": {
424 "unmanaged": true
425 },
426 "description": "Fired when a message is sent from either an extension pr ocess or a content script.",
427 "parameters": [
428 {"name": "message", "type": "any", "optional": true, "description": "T he message sent by the calling script."},
429 {"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)." }
431 ],
432 "returns": {
433 "type": "boolean",
434 "optional": true,
435 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
436 }
437 },
438 {
439 "name": "onMessageExternal",
440 "type": "function",
441 "options": {
442 "unmanaged": true
443 },
444 "description": "Fired when a message is sent from another extension/app. Cannot be used in a content script.",
445 "parameters": [
446 {"name": "message", "type": "any", "optional": true, "description": "T he message sent by the calling script."},
447 {"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)." }
449 ],
450 "returns": {
451 "type": "boolean",
452 "optional": true,
453 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
454 }
455 },
456 {
457 "name": "onRestartRequired",
458 "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.",
460 "parameters": [
461 {
462 "type": "string",
463 "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.",
465 "enum": ["app_update", "os_update", "periodic"]
466 }
467 ]
468 }
469 ]
470 }
471 ]
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | chrome/renderer/resources/extensions/last_error.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698