summaryrefslogtreecommitdiff
path: root/chromium/chrome/renderer/resources/extensions/web_request_custom_bindings.js
blob: 045fe963759ed8c22ae3d58a606cf4afb2c544a9 (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.binding = binding.generate();