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

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

Issue 9965005: Deprecate chrome.extension.sendRequest in favor of sendMessage, with a safer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better docs Created 8 years, 8 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
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
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.",
Aaron Boodman 2012/03/30 21:28:00 Do you want to just 'nodoc' this instead?
Matt Perry 2012/03/30 23:02:48 Done.
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,
Aaron Boodman 2012/03/30 21:28:00 Why not fix this as long as we're changing things?
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
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. If you have more than one <code>onMessage</code> listener in the s ame document, then only one may send a response. This function becomes invalid w hen the event listener returns, unless you return true from the event listener t o indicate you wish to send a response asynchronously (this will keep the messag e channel open to the other end until <code>sendResponse</code> is called)." }
310 }
311 }
312 ],
313 "returns": {
314 "type": "boolean",
315 "optional": "true",
316 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
317 }
318 },
319 {
320 "name": "onMessageExternal",
321 "type": "function",
322 "anonymous": true,
323 "description": "Fired when a message is sent from another extension.",
324 "parameters": [
325 {
326 "name": "details",
327 "type": "object",
328 "properties": {
329 "message": { "type": "any", "description": "The message sent by th e calling script."},
330 "sender": { "$ref": "MessageSender" },
331 "sendResponse": { "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-if iable object. If you have more than one <code>onMessage</code> listener in the s ame document, then only one may send a response. This function becomes invalid w hen the event listener returns, unless you return true from the event listener t o indicate you wish to send a response asynchronously (this will keep the messag e channel open to the other end until <code>sendResponse</code> is called)." }
332 }
333 }
334 ],
335 "returns": {
336 "type": "boolean",
337 "optional": "true",
338 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
339 }
272 } 340 }
273 ] 341 ]
274 } 342 }
275 ] 343 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698