summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/resources/extensions/tabs_custom_bindings.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/resources/extensions/tabs_custom_bindings.js')
-rw-r--r--chrome/renderer/resources/extensions/tabs_custom_bindings.js13
1 files changed, 4 insertions, 9 deletions
diff --git a/chrome/renderer/resources/extensions/tabs_custom_bindings.js b/chrome/renderer/resources/extensions/tabs_custom_bindings.js
index 0d7c405..90e5912 100644
--- a/chrome/renderer/resources/extensions/tabs_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/tabs_custom_bindings.js
@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Custom binding for the tabs API.
-
-var binding = require('binding').Binding.create('tabs');
+// Custom bindings for the tabs API.
var tabsNatives = requireNative('tabs');
var OpenChannelToTab = tabsNatives.OpenChannelToTab;
@@ -12,9 +10,8 @@ var sendRequestIsDisabled = requireNative('process').IsSendRequestDisabled();
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
-binding.registerCustomHook(function(bindingsAPI, extensionId) {
+chromeHidden.registerCustomHook('tabs', function(bindingsAPI, extensionId) {
var apiFunctions = bindingsAPI.apiFunctions;
- var tabs = bindingsAPI.compiledApi;
apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) {
var name = '';
@@ -29,15 +26,13 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) {
function(tabId, request, responseCallback) {
if (sendRequestIsDisabled)
throw new Error(sendRequestIsDisabled);
- var port = tabs.connect(tabId, {name: chromeHidden.kRequestChannel});
+ var port = chrome.tabs.connect(tabId, {name: chromeHidden.kRequestChannel});
chromeHidden.Port.sendMessageImpl(port, request, responseCallback);
});
apiFunctions.setHandleRequest('sendMessage',
function(tabId, message, responseCallback) {
- var port = tabs.connect(tabId, {name: chromeHidden.kMessageChannel});
+ var port = chrome.tabs.connect(tabId, {name: chromeHidden.kMessageChannel});
chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
});
});
-
-exports.binding = binding.generate();