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

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

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 tabs API. 5 // Custom bindings for the tabs API.
6 6
7 (function() { 7 var tabsNatives = requireNative('tabs');
8 var OpenChannelToTab = tabsNatives.OpenChannelToTab;
8 9
9 native function GetChromeHidden(); 10 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
10 native function OpenChannelToTab();
11
12 var chromeHidden = GetChromeHidden();
13 11
14 chromeHidden.registerCustomHook('tabs', function(bindingsAPI, extensionId) { 12 chromeHidden.registerCustomHook('tabs', function(bindingsAPI, extensionId) {
15 var apiFunctions = bindingsAPI.apiFunctions; 13 var apiFunctions = bindingsAPI.apiFunctions;
16 14
17 apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) { 15 apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) {
18 var name = ''; 16 var name = '';
19 if (connectInfo) { 17 if (connectInfo) {
20 name = connectInfo.name || name; 18 name = connectInfo.name || name;
21 } 19 }
22 var portId = OpenChannelToTab(tabId, extensionId, name); 20 var portId = OpenChannelToTab(tabId, extensionId, name);
(...skipping 14 matching lines...) Expand all
37 try { 35 try {
38 if (responseCallback) 36 if (responseCallback)
39 responseCallback(response); 37 responseCallback(response);
40 } finally { 38 } finally {
41 port.disconnect(); 39 port.disconnect();
42 port = null; 40 port = null;
43 } 41 }
44 }); 42 });
45 }); 43 });
46 }); 44 });
47
48 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698