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

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

Issue 302463005: Add support for AMD to the extensions module system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
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 binding for the tabs API. 5 // Custom binding for the tabs API.
6 6
7 var binding = require('binding').Binding.create('tabs'); 7 var binding = require('binding').Binding.create('tabs');
8 8
9 var messaging = require('messaging'); 9 var messaging = require('messaging');
10 var tabsNatives = requireNative('tabs'); 10 var tabsNatives = requireNative('tabs_natives');
11 var OpenChannelToTab = tabsNatives.OpenChannelToTab; 11 var OpenChannelToTab = tabsNatives.OpenChannelToTab;
12 var sendRequestIsDisabled = requireNative('process').IsSendRequestDisabled(); 12 var sendRequestIsDisabled = requireNative('process').IsSendRequestDisabled();
13 13
14 binding.registerCustomHook(function(bindingsAPI, extensionId) { 14 binding.registerCustomHook(function(bindingsAPI, extensionId) {
15 var apiFunctions = bindingsAPI.apiFunctions; 15 var apiFunctions = bindingsAPI.apiFunctions;
16 var tabs = bindingsAPI.compiledApi; 16 var tabs = bindingsAPI.compiledApi;
17 17
18 apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) { 18 apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) {
19 var name = ''; 19 var name = '';
20 if (connectInfo) { 20 if (connectInfo) {
(...skipping 12 matching lines...) Expand all
33 }); 33 });
34 34
35 apiFunctions.setHandleRequest('sendMessage', 35 apiFunctions.setHandleRequest('sendMessage',
36 function(tabId, message, responseCallback) { 36 function(tabId, message, responseCallback) {
37 var port = tabs.connect(tabId, {name: messaging.kMessageChannel}); 37 var port = tabs.connect(tabId, {name: messaging.kMessageChannel});
38 messaging.sendMessageImpl(port, message, responseCallback); 38 messaging.sendMessageImpl(port, message, responseCallback);
39 }); 39 });
40 }); 40 });
41 41
42 exports.binding = binding.generate(); 42 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698