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 (function() { |
8 | 8 |
9 native function GetChromeHidden(); | 9 native function GetChromeHidden(); |
10 native function OpenChannelToTab(); | 10 native function OpenChannelToTab(); |
(...skipping 25 matching lines...) Expand all Loading... |
36 port.onMessage.addListener(function(response) { | 36 port.onMessage.addListener(function(response) { |
37 try { | 37 try { |
38 if (responseCallback) | 38 if (responseCallback) |
39 responseCallback(response); | 39 responseCallback(response); |
40 } finally { | 40 } finally { |
41 port.disconnect(); | 41 port.disconnect(); |
42 port = null; | 42 port = null; |
43 } | 43 } |
44 }); | 44 }); |
45 }); | 45 }); |
46 | |
47 // TODO(skerner,mtytel): The next step to omitting optional arguments is the | |
48 // replacement of this code with code that matches arguments by type. | |
49 // Once this is working for captureVisibleTab() it can be enabled for | |
50 // the rest of the API. See crbug/29215 . | |
51 apiFunctions.setUpdateArgumentsPreValidate('captureVisibleTab', function() { | |
52 // Old signature: | |
53 // captureVisibleTab(int windowId, function callback); | |
54 // New signature: | |
55 // captureVisibleTab(int windowId, object details, function callback); | |
56 var newArgs; | |
57 if (arguments.length == 2 && typeof(arguments[1]) == 'function') { | |
58 // If the old signature is used, add a null details object. | |
59 newArgs = [arguments[0], null, arguments[1]]; | |
60 } else { | |
61 newArgs = arguments; | |
62 } | |
63 return newArgs; | |
64 }); | |
65 }); | 46 }); |
66 | 47 |
67 })(); | 48 })(); |
OLD | NEW |