summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/resources/web_request_custom_bindings.js
blob: 2dd7ce4f0487b16b174e7196e5496693b04e9e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Custom binding for the webRequest API.

var binding = require('binding').Binding.create('webRequest');
var sendRequest = require('sendRequest').sendRequest;
var WebRequestEvent = require('webRequestInternal').WebRequestEvent;

binding.registerCustomHook(function(api) {
  var apiFunctions = api.apiFunctions;

  apiFunctions.setHandleRequest('handlerBehaviorChanged', function() {
    var args = $Array.slice(arguments);
    sendRequest(this.name, args, this.definition.parameters,
                {forIOThread: true});
  });
});

binding.registerCustomEvent(WebRequestEvent);

exports.$set('binding', binding.generate());