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 extension API. | 5 // Custom bindings for the extension API. |
6 | 6 |
7 (function() { | 7 var GetChromeHidden = natives.GetChromeHidden; |
8 | 8 var GetExtensionViews = natives.GetExtensionViews; |
9 native function GetChromeHidden(); | |
10 native function GetExtensionViews(); | |
11 | 9 |
12 // This should match chrome.windows.WINDOW_ID_NONE. | 10 // This should match chrome.windows.WINDOW_ID_NONE. |
13 // | 11 // |
14 // We can't use chrome.windows.WINDOW_ID_NONE directly because the | 12 // We can't use chrome.windows.WINDOW_ID_NONE directly because the |
15 // chrome.windows API won't exist unless this extension has permission for it; | 13 // chrome.windows API won't exist unless this extension has permission for it; |
16 // which may not be the case. | 14 // which may not be the case. |
17 var WINDOW_ID_NONE = -1; | 15 var WINDOW_ID_NONE = -1; |
18 | 16 |
19 GetChromeHidden().registerCustomHook('extension', function(bindingsAPI) { | 17 GetChromeHidden().registerCustomHook('extension', function(bindingsAPI) { |
20 // getTabContentses is retained for backwards compatibility. | 18 // getTabContentses is retained for backwards compatibility. |
(...skipping 21 matching lines...) Expand all Loading... |
42 return GetExtensionViews(-1, "BACKGROUND")[0] || null; | 40 return GetExtensionViews(-1, "BACKGROUND")[0] || null; |
43 }); | 41 }); |
44 | 42 |
45 apiFunctions.setHandleRequest("extension.getExtensionTabs", | 43 apiFunctions.setHandleRequest("extension.getExtensionTabs", |
46 function(windowId) { | 44 function(windowId) { |
47 if (typeof(windowId) == "undefined") | 45 if (typeof(windowId) == "undefined") |
48 windowId = WINDOW_ID_NONE; | 46 windowId = WINDOW_ID_NONE; |
49 return GetExtensionViews(windowId, "TAB"); | 47 return GetExtensionViews(windowId, "TAB"); |
50 }); | 48 }); |
51 }); | 49 }); |
52 | |
53 })(); | |
OLD | NEW |