Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Side by Side Diff: chrome/renderer/resources/extensions/extension_custom_bindings.js

Issue 9657026: Revert 125801 - Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 extension API. 5 // Custom bindings for the extension API.
6 6
7 var extensionNatives = requireNative('extension'); 7 (function() {
8 var GetExtensionViews = extensionNatives.GetExtensionViews;
9 var OpenChannelToExtension = extensionNatives.OpenChannelToExtension;
10 8
11 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 9 native function GetChromeHidden();
10 native function GetExtensionViews();
11 native function OpenChannelToExtension(sourceId, targetId, name);
12
13 var chromeHidden = GetChromeHidden();
12 14
13 // This should match chrome.windows.WINDOW_ID_NONE. 15 // This should match chrome.windows.WINDOW_ID_NONE.
14 // 16 //
15 // We can't use chrome.windows.WINDOW_ID_NONE directly because the 17 // We can't use chrome.windows.WINDOW_ID_NONE directly because the
16 // chrome.windows API won't exist unless this extension has permission for it; 18 // chrome.windows API won't exist unless this extension has permission for it;
17 // which may not be the case. 19 // which may not be the case.
18 var WINDOW_ID_NONE = -1; 20 var WINDOW_ID_NONE = -1;
19 21
20 chromeHidden.registerCustomHook('extension', 22 chromeHidden.registerCustomHook('extension',
21 function(bindingsAPI, extensionId) { 23 function(bindingsAPI, extensionId) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 var name = ''; 137 var name = '';
136 if (connectInfo && connectInfo.name) 138 if (connectInfo && connectInfo.name)
137 name = connectInfo.name; 139 name = connectInfo.name;
138 140
139 var portId = OpenChannelToExtension(extensionId, targetId, name); 141 var portId = OpenChannelToExtension(extensionId, targetId, name);
140 if (portId >= 0) 142 if (portId >= 0)
141 return chromeHidden.Port.createPort(portId, name); 143 return chromeHidden.Port.createPort(portId, name);
142 throw new Error('Error connecting to extension ' + targetId); 144 throw new Error('Error connecting to extension ' + targetId);
143 }); 145 });
144 }); 146 });
147
148 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698