OLD | NEW |
---|---|
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 {forIOThread: true}); | 168 {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 {forIOThread: true}); |
175 }); | 175 }); |
176 }); | 176 }); |
177 | 177 |
178 var WebRequestEvent = utils.expose('WebRequestEvent', | 178 function WebRequestEvent() { |
179 WebRequestEventImpl, | 179 privates(WebRequestEvent).constructPrivate(this, arguments); |
180 { functions: [ | 180 } |
181 'hasListener', | 181 utils.expose(WebRequestEvent, WebRequestEventImpl, { |
182 'hasListeners', | 182 functions: [ |
183 'addListener', | 183 'hasListener', |
184 'removeListener', | 184 'hasListeners', |
185 'addRules', | 185 'addListener', |
186 'removeRules', | 186 'removeListener', |
187 'getRules' | 187 'addRules', |
188 ] }); | 188 'removeRules', |
189 'getRules', | |
190 ], | |
191 }); | |
189 | 192 |
190 webRequestInternal = binding.generate(); | 193 webRequestInternal = binding.generate(); |
191 exports.$set('binding', webRequestInternal); | 194 exports.$set('binding', webRequestInternal); |
Devlin
2016/04/22 18:52:46
nit: since you're here, may as well inline the bin
robwu
2016/04/22 20:33:43
webRequestInternal is also used internally within
| |
192 exports.$set('WebRequestEvent', WebRequestEvent); | 195 exports.$set('WebRequestEvent', WebRequestEvent); |
OLD | NEW |