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

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: sync 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
« no previous file with comments | « no previous file | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 "optional": true 81 "optional": true
82 } 82 }
83 ], 83 ],
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 "nodoc": true,
91 "type": "function", 92 "type": "function",
92 "allowAmbiguousOptionalArguments": true, 93 "allowAmbiguousOptionalArguments": true,
93 "unprivileged": true, 94 "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.", 95 "description": "Deprecated: Please use sendMessage.",
95 "parameters": [ 96 "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."}, 97 {"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" }, 98 { "type": "any", "name": "request" },
98 { 99 {
99 "type": "function", 100 "type": "function",
100 "name": "responseCallback", 101 "name": "responseCallback",
101 "optional": true, 102 "optional": true,
102 "parameters": [ 103 "parameters": [
103 { 104 {
104 "name": "response", 105 "name": "response",
105 "type": "any", 106 "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." 107 "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 } 108 }
108 ] 109 ]
109 } 110 }
110 ] 111 ]
111 }, 112 },
112 { 113 {
114 "name": "sendMessage",
115 "type": "function",
116 "allowAmbiguousOptionalArguments": true,
117 "unprivileged": true,
118 "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.",
119 "parameters": [
120 {"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."},
121 { "type": "any", "name": "message" },
122 {
123 "type": "function",
124 "name": "responseCallback",
125 "optional": true,
126 "parameters": [
127 {
128 "name": "response",
129 "type": "any",
130 "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."
131 }
132 ]
133 }
134 ]
135 },
136 {
113 "name": "getURL", 137 "name": "getURL",
114 "type": "function", 138 "type": "function",
115 "unprivileged": true, 139 "unprivileged": true,
116 "description": "Converts a relative path within an extension install dir ectory to a fully-qualified URL.", 140 "description": "Converts a relative path within an extension install dir ectory to a fully-qualified URL.",
117 "parameters": [ 141 "parameters": [
118 { 142 {
119 "type": "string", 143 "type": "string",
120 "name": "path", 144 "name": "path",
121 "description": "A path to a resource within an extension expressed r elative to its install directory." 145 "description": "A path to a resource within an extension expressed r elative to its install directory."
122 } 146 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 "name": "onConnectExternal", 266 "name": "onConnectExternal",
243 "type": "function", 267 "type": "function",
244 "anonymous": true, 268 "anonymous": true,
245 "description": "Fired when a connection is made from another extension." , 269 "description": "Fired when a connection is made from another extension." ,
246 "parameters": [ 270 "parameters": [
247 {"$ref": "Port", "name": "port"} 271 {"$ref": "Port", "name": "port"}
248 ] 272 ]
249 }, 273 },
250 { 274 {
251 "name": "onRequest", 275 "name": "onRequest",
276 "nodoc": true,
252 "type": "function", 277 "type": "function",
253 "anonymous": true, 278 "anonymous": true,
254 "unprivileged": true, 279 "unprivileged": true,
255 "description": "Fired when a request is sent from either an extension pr ocess or a content script.", 280 "description": "Deprecated: please use onMessage.",
256 "parameters": [ 281 "parameters": [
257 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, 282 {"name": "request", "type": "any", "description": "The request sent by the calling script."},
258 {"name": "sender", "$ref": "MessageSender" }, 283 {"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." } 284 {"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 ] 285 ]
261 }, 286 },
262 { 287 {
263 "name": "onRequestExternal", 288 "name": "onRequestExternal",
289 "nodoc": true,
264 "type": "function", 290 "type": "function",
265 "anonymous": true, 291 "anonymous": true,
266 "description": "Fired when a request is sent from another extension.", 292 "description": "Deprecated: please use onMessageExternal.",
267 "parameters": [ 293 "parameters": [
268 {"name": "request", "type": "any", "description": "The request sent by the calling script."}, 294 {"name": "request", "type": "any", "description": "The request sent by the calling script."},
269 {"name": "sender", "$ref": "MessageSender" }, 295 {"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." } 296 {"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 ] 297 ]
298 },
299 {
300 "name": "onMessage",
301 "type": "function",
302 "anonymous": true,
303 "unprivileged": true,
304 "description": "Fired when a message is sent from either an extension pr ocess or a content script.",
305 "parameters": [
306 {
307 "name": "details",
308 "type": "object",
309 "properties": {
310 "message": { "type": "any", "description": "The message sent by th e calling script."},
311 "sender": { "$ref": "MessageSender" },
312 "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)." }
313 }
314 }
315 ],
316 "returns": {
317 "type": "boolean",
318 "optional": "true",
319 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
320 }
321 },
322 {
323 "name": "onMessageExternal",
324 "type": "function",
325 "anonymous": true,
326 "description": "Fired when a message is sent from another extension.",
327 "parameters": [
328 {
329 "name": "details",
330 "type": "object",
331 "properties": {
332 "message": { "type": "any", "description": "The message sent by th e calling script."},
333 "sender": { "$ref": "MessageSender" },
334 "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)." }
335 }
336 }
337 ],
338 "returns": {
339 "type": "boolean",
340 "optional": "true",
341 "description": "Return true from the event listener if you wish to cal l <code>sendResponse</code> after the event listener returns."
342 }
272 } 343 }
273 ] 344 ]
274 } 345 }
275 ] 346 ]
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/tabs.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698