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