OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CHECK = requireNative('logging').CHECK; | 5 var CHECK = requireNative('logging').CHECK; |
6 var eventBindings = bindingUtil ? undefined : require('event_bindings'); | 6 var eventBindings = bindingUtil ? undefined : require('event_bindings'); |
7 var idGeneratorNatives = requireNative('id_generator'); | 7 var idGeneratorNatives = requireNative('id_generator'); |
8 var utils = require('utils'); | 8 var utils = require('utils'); |
9 var validate = require('schemaUtils').validate; | 9 var validate = require('schemaUtils').validate; |
10 var webRequestInternal = getInternalApi ? | 10 var webRequestInternal = getInternalApi ? |
11 getInternalApi('webRequestInternal') : | 11 getInternalApi('webRequestInternal') : |
12 require('binding').Binding.create('webRequestInternal').generate(); | 12 require('binding').Binding.create('webRequestInternal').generate(); |
13 | 13 |
14 function getUniqueSubEventName(eventName) { | 14 function getUniqueSubEventName(eventName) { |
15 return eventName + '/' + idGeneratorNatives.GetNextId(); | 15 return eventName + '/' + idGeneratorNatives.GetNextId(); |
16 } | 16 } |
17 | 17 |
18 function createSubEvent(name, argSchemas) { | 18 function createSubEvent(name, argSchemas) { |
19 if (bindingUtil) | 19 if (bindingUtil) { |
20 return bindingUtil.createCustomEvent(name, undefined, false); | 20 var supportsFilters = false; |
| 21 var supportsLazyListeners = true; |
| 22 return bindingUtil.createCustomEvent(name, undefined, |
| 23 supportsFilters, |
| 24 supportsLazyListeners); |
| 25 } |
21 return new eventBindings.Event(name, argSchemas); | 26 return new eventBindings.Event(name, argSchemas); |
22 } | 27 } |
23 | 28 |
24 // WebRequestEventImpl object. This is used for special webRequest events | 29 // WebRequestEventImpl object. This is used for special webRequest events |
25 // with extra parameters. Each invocation of addListener creates a new named | 30 // with extra parameters. Each invocation of addListener creates a new named |
26 // sub-event. That sub-event is associated with the extra parameters in the | 31 // sub-event. That sub-event is associated with the extra parameters in the |
27 // browser process, so that only it is dispatched when the main event occurs | 32 // browser process, so that only it is dispatched when the main event occurs |
28 // matching the extra parameters. | 33 // matching the extra parameters. |
29 // | 34 // |
30 // Example: | 35 // Example: |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 'addListener', | 175 'addListener', |
171 'removeListener', | 176 'removeListener', |
172 'addRules', | 177 'addRules', |
173 'removeRules', | 178 'removeRules', |
174 'getRules', | 179 'getRules', |
175 ], | 180 ], |
176 }); | 181 }); |
177 | 182 |
178 exports.$set('WebRequestEvent', WebRequestEvent); | 183 exports.$set('WebRequestEvent', WebRequestEvent); |
179 exports.$set('createWebRequestEvent', createWebRequestEvent); | 184 exports.$set('createWebRequestEvent', createWebRequestEvent); |
OLD | NEW |