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

Side by Side Diff: chrome/renderer/resources/extensions/send_request.js

Issue 10703111: Cleanup: make ExtensionRequestSender manage its IPC responses directly, rather (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScopedObserverify Created 8 years, 5 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 | « chrome/renderer/extensions/set_icon_natives.cc ('k') | no next file » | 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 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 5 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
6 var lastError = require('lastError'); 6 var lastError = require('lastError');
7 var natives = requireNative('sendRequest'); 7 var natives = requireNative('sendRequest');
8 var validate = require('schemaUtils').validate; 8 var validate = require('schemaUtils').validate;
9 9
10 // Callback handling. 10 // Callback handling.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // TODO(asargent) - convert all optional native functions to accept raw 108 // TODO(asargent) - convert all optional native functions to accept raw
109 // v8 values instead of expecting JSON strings. 109 // v8 values instead of expecting JSON strings.
110 var doStringify = false; 110 var doStringify = false;
111 if (opt_args.nativeFunction && !opt_args.noStringify) 111 if (opt_args.nativeFunction && !opt_args.noStringify)
112 doStringify = true; 112 doStringify = true;
113 var requestArgs = doStringify ? 113 var requestArgs = doStringify ?
114 chromeHidden.JSON.stringify(request.args) : request.args; 114 chromeHidden.JSON.stringify(request.args) : request.args;
115 var nativeFunction = opt_args.nativeFunction || natives.StartRequest; 115 var nativeFunction = opt_args.nativeFunction || natives.StartRequest;
116 116
117 var requestId = natives.GetNextRequestId(); 117 var hasCallback = !!(request.callback || opt_args.customCallback);
118 request.id = requestId; 118 var requestId = nativeFunction(functionName,
koz (OOO until 15th September) 2012/07/09 01:12:37 set_icon.js provides a nativeFunction() to be call
not at google - send to devlin 2012/07/09 02:04:16 Thanks for noticing. I just checked and set_icon.j
119 requests[requestId] = request; 119 requestArgs,
120 var hasCallback = 120 hasCallback,
121 (request.callback || opt_args.customCallback) ? true : false; 121 opt_args.forIOThread);
122 return nativeFunction(functionName, requestArgs, requestId, hasCallback, 122 if (typeof(requestId) == 'number' && requestId >= 0) {
123 opt_args.forIOThread); 123 request.id = requestId;
124 requests[requestId] = request;
125 }
124 } 126 }
125 127
126 exports.sendRequest = sendRequest; 128 exports.sendRequest = sendRequest;
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/set_icon_natives.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698