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 bindings for the webRequest API. | 5 // Custom bindings for the webRequest API. |
6 | 6 |
7 (function() { | 7 (function() { |
8 | 8 |
9 native function GetChromeHidden(); | 9 var web_request = requireNative('web_request'); |
10 native function GetUniqueSubEventName(eventName); | 10 var GetUniqueSubEventName = web_request.GetUniqueSubEventName; |
11 | 11 |
12 var chromeHidden = GetChromeHidden(); | 12 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
13 | 13 |
14 // WebRequestEvent object. This is used for special webRequest events with | 14 // WebRequestEvent object. This is used for special webRequest events with |
15 // extra parameters. Each invocation of addListener creates a new named | 15 // extra parameters. Each invocation of addListener creates a new named |
16 // sub-event. That sub-event is associated with the extra parameters in the | 16 // sub-event. That sub-event is associated with the extra parameters in the |
17 // browser process, so that only it is dispatched when the main event occurs | 17 // browser process, so that only it is dispatched when the main event occurs |
18 // matching the extra parameters. | 18 // matching the extra parameters. |
19 // | 19 // |
20 // Example: | 20 // Example: |
21 // chrome.webRequest.onBeforeRequest.addListener( | 21 // chrome.webRequest.onBeforeRequest.addListener( |
22 // callback, {urls: "http://*.google.com/*"}); | 22 // callback, {urls: "http://*.google.com/*"}); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 apiFunctions.setHandleRequest("webRequest.handlerBehaviorChanged", | 171 apiFunctions.setHandleRequest("webRequest.handlerBehaviorChanged", |
172 function() { | 172 function() { |
173 var args = Array.prototype.slice.call(arguments); | 173 var args = Array.prototype.slice.call(arguments); |
174 sendRequest(this.name, args, this.definition.parameters, | 174 sendRequest(this.name, args, this.definition.parameters, |
175 {forIOThread: true}); | 175 {forIOThread: true}); |
176 }); | 176 }); |
177 }); | 177 }); |
178 | 178 |
179 })(); | 179 })(); |
OLD | NEW |