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

Side by Side Diff: extensions/renderer/resources/web_request_internal_custom_bindings.js

Issue 1914643003: [Extensions] Update last_error.js, send_request.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 // Custom binding for the webRequestInternal API. 5 // Custom binding for the webRequestInternal API.
6 6
7 var binding = require('binding').Binding.create('webRequestInternal'); 7 var binding = require('binding').Binding.create('webRequestInternal');
8 var eventBindings = require('event_bindings'); 8 var eventBindings = require('event_bindings');
9 var sendRequest = require('sendRequest').sendRequest; 9 var sendRequest = require('sendRequest').sendRequest;
10 var validate = require('schemaUtils').validate; 10 var validate = require('schemaUtils').validate;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 throw new Error('This event does not support rules.'); 158 throw new Error('This event does not support rules.');
159 this.eventForRules.getRules(ruleIdentifiers, cb); 159 this.eventForRules.getRules(ruleIdentifiers, cb);
160 }; 160 };
161 161
162 binding.registerCustomHook(function(api) { 162 binding.registerCustomHook(function(api) {
163 var apiFunctions = api.apiFunctions; 163 var apiFunctions = api.apiFunctions;
164 164
165 apiFunctions.setHandleRequest('addEventListener', function() { 165 apiFunctions.setHandleRequest('addEventListener', function() {
166 var args = $Array.slice(arguments); 166 var args = $Array.slice(arguments);
167 sendRequest(this.name, args, this.definition.parameters, 167 sendRequest(this.name, args, this.definition.parameters,
168 {forIOThread: true}); 168 {__proto__: null, forIOThread: true});
169 }); 169 });
170 170
171 apiFunctions.setHandleRequest('eventHandled', function() { 171 apiFunctions.setHandleRequest('eventHandled', function() {
172 var args = $Array.slice(arguments); 172 var args = $Array.slice(arguments);
173 sendRequest(this.name, args, this.definition.parameters, 173 sendRequest(this.name, args, this.definition.parameters,
174 {forIOThread: true}); 174 {__proto__: null, forIOThread: true});
175 }); 175 });
176 }); 176 });
177 177
178 var WebRequestEvent = utils.expose('WebRequestEvent', 178 var WebRequestEvent = utils.expose('WebRequestEvent',
179 WebRequestEventImpl, 179 WebRequestEventImpl,
180 { functions: [ 180 { functions: [
181 'hasListener', 181 'hasListener',
182 'hasListeners', 182 'hasListeners',
183 'addListener', 183 'addListener',
184 'removeListener', 184 'removeListener',
185 'addRules', 185 'addRules',
186 'removeRules', 186 'removeRules',
187 'getRules' 187 'getRules'
188 ] }); 188 ] });
189 189
190 webRequestInternal = binding.generate(); 190 webRequestInternal = binding.generate();
191 exports.$set('binding', webRequestInternal); 191 exports.$set('binding', webRequestInternal);
192 exports.$set('WebRequestEvent', WebRequestEvent); 192 exports.$set('WebRequestEvent', WebRequestEvent);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698