| Index: chrome/renderer/resources/extensions/runtime_custom_bindings.js
|
| ===================================================================
|
| --- chrome/renderer/resources/extensions/runtime_custom_bindings.js (revision 184858)
|
| +++ chrome/renderer/resources/extensions/runtime_custom_bindings.js (working copy)
|
| @@ -2,10 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Custom binding for the runtime API.
|
| +// Custom bindings for the runtime API.
|
|
|
| -var binding = require('binding').Binding.create('runtime');
|
| -
|
| var runtimeNatives = requireNative('runtime');
|
| var extensionNatives = requireNative('extension');
|
| var GetExtensionViews = extensionNatives.GetExtensionViews;
|
| @@ -15,15 +13,14 @@
|
| var sendMessageUpdateArguments =
|
| require('miscellaneous_bindings').sendMessageUpdateArguments;
|
|
|
| -binding.registerCustomHook(function(binding, id, contextType) {
|
| - var apiFunctions = binding.apiFunctions;
|
| - var runtime = binding.compiledApi;
|
| +chromeHidden.registerCustomHook('runtime', function(bindings, id, contextType) {
|
| + var apiFunctions = bindings.apiFunctions;
|
|
|
| //
|
| // Unprivileged APIs.
|
| //
|
|
|
| - runtime.id = id;
|
| + chrome.runtime.id = id;
|
|
|
| apiFunctions.setHandleRequest('getManifest', function() {
|
| return runtimeNatives.GetManifest();
|
| @@ -43,14 +40,14 @@
|
|
|
| apiFunctions.setHandleRequest('sendMessage',
|
| function(targetId, message, responseCallback) {
|
| - var port = runtime.connect(targetId || runtime.id,
|
| + var port = chrome.runtime.connect(targetId || chrome.runtime.id,
|
| {name: chromeHidden.kMessageChannel});
|
| chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
|
| });
|
|
|
| apiFunctions.setHandleRequest('sendNativeMessage',
|
| function(targetId, message, responseCallback) {
|
| - var port = runtime.connectNative(targetId);
|
| + var port = chrome.runtime.connectNative(targetId);
|
| chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
|
| });
|
|
|
| @@ -86,7 +83,7 @@
|
|
|
| apiFunctions.setHandleRequest('connect', function(targetId, connectInfo) {
|
| if (!targetId)
|
| - targetId = runtime.id;
|
| + targetId = chrome.runtime.id;
|
| var name = '';
|
| if (connectInfo && connectInfo.name)
|
| name = connectInfo.name;
|
| @@ -94,7 +91,7 @@
|
| // Don't let orphaned content scripts communicate with their extension.
|
| // http://crbug.com/168263
|
| if (!chromeHidden.wasUnloaded) {
|
| - var portId = OpenChannelToExtension(runtime.id, targetId, name);
|
| + var portId = OpenChannelToExtension(chrome.runtime.id, targetId, name);
|
| if (portId >= 0)
|
| return chromeHidden.Port.createPort(portId, name);
|
| }
|
| @@ -110,7 +107,7 @@
|
| apiFunctions.setHandleRequest('connectNative',
|
| function(nativeAppName) {
|
| if (!chromeHidden.wasUnloaded) {
|
| - var portId = OpenChannelToNativeApp(runtime.id, nativeAppName);
|
| + var portId = OpenChannelToNativeApp(chrome.runtime.id, nativeAppName);
|
| if (portId >= 0)
|
| return chromeHidden.Port.createPort(portId, '');
|
| }
|
| @@ -127,5 +124,3 @@
|
| });
|
|
|
| });
|
| -
|
| -exports.binding = binding.generate();
|
|
|
|
|