| 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 // This script contains privileged chrome extension related javascript APIs. | 5 // This script contains privileged chrome extension related javascript APIs. | 
| 6 // It is loaded by pages whose URL has the chrome-extension protocol. | 6 // It is loaded by pages whose URL has the chrome-extension protocol. | 
| 7 | 7 | 
| 8 var chrome = chrome || {}; | 8 var chrome = chrome || {}; | 
| 9 (function() { | 9 (function() { | 
| 10   native function GetChromeHidden(); | 10   native function GetChromeHidden(); | 
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 907           request.callback(fs); | 907           request.callback(fs); | 
| 908         request.callback = null; | 908         request.callback = null; | 
| 909       }); | 909       }); | 
| 910 | 910 | 
| 911     apiFunctions.setHandleRequest("chromePrivate.decodeJPEG", | 911     apiFunctions.setHandleRequest("chromePrivate.decodeJPEG", | 
| 912       function(jpeg_image) { | 912       function(jpeg_image) { | 
| 913         return DecodeJPEG(jpeg_image); | 913         return DecodeJPEG(jpeg_image); | 
| 914       }); | 914       }); | 
| 915 | 915 | 
| 916     apiFunctions.setHandleRequest("extension.getViews", function(properties) { | 916     apiFunctions.setHandleRequest("extension.getViews", function(properties) { | 
| 917       var windowId = -1; | 917       var windowId = chrome.windows.WINDOW_ID_NONE; | 
| 918       var type = "ALL"; | 918       var type = "ALL"; | 
| 919       if (typeof(properties) != "undefined") { | 919       if (typeof(properties) != "undefined") { | 
| 920         if (typeof(properties.type) != "undefined") { | 920         if (typeof(properties.type) != "undefined") { | 
| 921           type = properties.type; | 921           type = properties.type; | 
| 922         } | 922         } | 
| 923         if (typeof(properties.windowId) != "undefined") { | 923         if (typeof(properties.windowId) != "undefined") { | 
| 924           windowId = properties.windowId; | 924           windowId = properties.windowId; | 
| 925         } | 925         } | 
| 926       } | 926       } | 
| 927       return GetExtensionViews(windowId, type) || null; | 927       return GetExtensionViews(windowId, type) || null; | 
| 928     }); | 928     }); | 
| 929 | 929 | 
| 930     apiFunctions.setHandleRequest("extension.getBackgroundPage", function() { | 930     apiFunctions.setHandleRequest("extension.getBackgroundPage", function() { | 
| 931       return GetExtensionViews(-1, "BACKGROUND")[0] || null; | 931       return GetExtensionViews(-1, "BACKGROUND")[0] || null; | 
| 932     }); | 932     }); | 
| 933 | 933 | 
| 934     apiFunctions.setHandleRequest("extension.getExtensionTabs", | 934     apiFunctions.setHandleRequest("extension.getExtensionTabs", | 
| 935         function(windowId) { | 935         function(windowId) { | 
| 936       if (typeof(windowId) == "undefined") | 936       if (typeof(windowId) == "undefined") | 
| 937         windowId = -1; | 937         windowId = chrome.windows.WINDOW_ID_NONE; | 
| 938       return GetExtensionViews(windowId, "TAB"); | 938       return GetExtensionViews(windowId, "TAB"); | 
| 939     }); | 939     }); | 
| 940 | 940 | 
| 941     apiFunctions.setHandleRequest("devtools.getTabEvents", function(tabId) { | 941     apiFunctions.setHandleRequest("devtools.getTabEvents", function(tabId) { | 
| 942       var tabIdProxy = {}; | 942       var tabIdProxy = {}; | 
| 943       var functions = ["onPageEvent", "onTabClose"]; | 943       var functions = ["onPageEvent", "onTabClose"]; | 
| 944       functions.forEach(function(name) { | 944       functions.forEach(function(name) { | 
| 945         // Event disambiguation is handled by name munging.  See | 945         // Event disambiguation is handled by name munging.  See | 
| 946         // chrome/browser/extensions/extension_devtools_events.h for the C++ | 946         // chrome/browser/extensions/extension_devtools_events.h for the C++ | 
| 947         // equivalent of this logic. | 947         // equivalent of this logic. | 
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1236     if (apiExists("pageActions")) | 1236     if (apiExists("pageActions")) | 
| 1237       setupPageActionEvents(extensionId); | 1237       setupPageActionEvents(extensionId); | 
| 1238     if (apiExists("experimental.socket")) | 1238     if (apiExists("experimental.socket")) | 
| 1239       setupSocketEvents(); | 1239       setupSocketEvents(); | 
| 1240     if (apiExists("ttsEngine")) | 1240     if (apiExists("ttsEngine")) | 
| 1241       setupTtsEngineEvents(); | 1241       setupTtsEngineEvents(); | 
| 1242     if (apiExists("tts")) | 1242     if (apiExists("tts")) | 
| 1243       setupTtsEvents(); | 1243       setupTtsEvents(); | 
| 1244   }); | 1244   }); | 
| 1245 })(); | 1245 })(); | 
| OLD | NEW | 
|---|