OLD | NEW |
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 GetChromeHidden = natives.GetChromeHidden; |
8 | 8 var OpenChannelToTab = natives.OpenChannelToTab; |
9 native function GetChromeHidden(); | |
10 native function OpenChannelToTab(); | |
11 | 9 |
12 var chromeHidden = GetChromeHidden(); | 10 var chromeHidden = GetChromeHidden(); |
13 | 11 |
14 chromeHidden.registerCustomHook('tabs', function(bindingsAPI) { | 12 chromeHidden.registerCustomHook('tabs', function(bindingsAPI) { |
15 var apiFunctions = bindingsAPI.apiFunctions; | 13 var apiFunctions = bindingsAPI.apiFunctions; |
16 | 14 |
17 apiFunctions.setHandleRequest('tabs.connect', function(tabId, connectInfo) { | 15 apiFunctions.setHandleRequest('tabs.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; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 var newArgs; | 55 var newArgs; |
58 if (arguments.length == 2 && typeof(arguments[1]) == 'function') { | 56 if (arguments.length == 2 && typeof(arguments[1]) == 'function') { |
59 // If the old signature is used, add a null details object. | 57 // If the old signature is used, add a null details object. |
60 newArgs = [arguments[0], null, arguments[1]]; | 58 newArgs = [arguments[0], null, arguments[1]]; |
61 } else { | 59 } else { |
62 newArgs = arguments; | 60 newArgs = arguments; |
63 } | 61 } |
64 return newArgs; | 62 return newArgs; |
65 }); | 63 }); |
66 }); | 64 }); |
67 | |
68 })(); | |
OLD | NEW |