OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 Object.defineProperty(chrome.experimental.devtools, properties[i], d
escriptor); | 1016 Object.defineProperty(chrome.experimental.devtools, properties[i], d
escriptor); |
1017 } | 1017 } |
1018 chrome.experimental.devtools.inspectedWindow = chrome.devtools.inspected
Window; | 1018 chrome.experimental.devtools.inspectedWindow = chrome.devtools.inspected
Window; |
1019 } | 1019 } |
1020 if (extensionInfo.exposeWebInspectorNamespace) | 1020 if (extensionInfo.exposeWebInspectorNamespace) |
1021 window.webInspector = coreAPI; | 1021 window.webInspector = coreAPI; |
1022 } | 1022 } |
1023 | 1023 |
1024 /** | 1024 /** |
1025 * @param {!ExtensionDescriptor} extensionInfo | 1025 * @param {!ExtensionDescriptor} extensionInfo |
| 1026 * @param {string} inspectedTabId |
1026 * @return {string} | 1027 * @return {string} |
1027 */ | 1028 */ |
1028 function buildPlatformExtensionAPI(extensionInfo) | 1029 function buildPlatformExtensionAPI(extensionInfo, inspectedTabId) |
1029 { | 1030 { |
1030 return "var extensionInfo = " + JSON.stringify(extensionInfo) + ";" + | 1031 return "var extensionInfo = " + JSON.stringify(extensionInfo) + ";" + |
1031 "var tabId = " + WebInspector._inspectedTabId + ";" + | 1032 "var tabId = " + inspectedTabId + ";" + |
1032 platformExtensionAPI.toString(); | 1033 platformExtensionAPI.toString(); |
1033 } | 1034 } |
1034 | 1035 |
1035 /** | 1036 /** |
1036 * @param {!ExtensionDescriptor} extensionInfo | 1037 * @param {!ExtensionDescriptor} extensionInfo |
| 1038 * @param {string} inspectedTabId |
1037 * @return {string} | 1039 * @return {string} |
1038 */ | 1040 */ |
1039 function buildExtensionAPIInjectedScript(extensionInfo) | 1041 function buildExtensionAPIInjectedScript(extensionInfo, inspectedTabId) |
1040 { | 1042 { |
1041 return "(function(injectedScriptId){ " + | 1043 return "(function(injectedScriptId){ " + |
1042 "var extensionServer;" + | 1044 "var extensionServer;" + |
1043 defineCommonExtensionSymbols.toString() + ";" + | 1045 defineCommonExtensionSymbols.toString() + ";" + |
1044 injectedExtensionAPI.toString() + ";" + | 1046 injectedExtensionAPI.toString() + ";" + |
1045 buildPlatformExtensionAPI(extensionInfo) + ";" + | 1047 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + |
1046 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1048 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
1047 "return {};" + | 1049 "return {};" + |
1048 "})"; | 1050 "})"; |
1049 } | 1051 } |
OLD | NEW |