| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * @constructor | 28 * @constructor |
| 29 * @extends {WebInspector.Panel} | 29 * @extends {WebInspector.Panel} |
| 30 * @implements {WebInspector.ContextMenu.Provider} | 30 * @implements {WebInspector.ContextMenu.Provider} |
| 31 * @implements {WebInspector.TargetManager.Observer} |
| 31 * @param {!WebInspector.Workspace=} workspaceForTest | 32 * @param {!WebInspector.Workspace=} workspaceForTest |
| 32 */ | 33 */ |
| 33 WebInspector.SourcesPanel = function(workspaceForTest) | 34 WebInspector.SourcesPanel = function(workspaceForTest) |
| 34 { | 35 { |
| 35 WebInspector.Panel.call(this, "sources"); | 36 WebInspector.Panel.call(this, "sources"); |
| 36 this.registerRequiredCSS("sources/sourcesPanel.css"); | 37 this.registerRequiredCSS("sources/sourcesPanel.css"); |
| 37 new WebInspector.DropTarget(this.element, [WebInspector.DropTarget.Types.Fil
es], WebInspector.UIString("Drop workspace folder here"), this._handleDrop.bind(
this)); | 38 new WebInspector.DropTarget(this.element, [WebInspector.DropTarget.Types.Fil
es], WebInspector.UIString("Drop workspace folder here"), this._handleDrop.bind(
this)); |
| 38 | 39 |
| 39 this._workspace = workspaceForTest || WebInspector.workspace; | 40 this._workspace = workspaceForTest || WebInspector.workspace; |
| 40 this._networkMapping = WebInspector.networkMapping; | 41 this._networkMapping = WebInspector.networkMapping; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Selected, this._sourceSelected, this); | 68 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Selected, this._sourceSelected, this); |
| 68 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Renamed, this._sourceRenamed, this); | 69 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Renamed, this._sourceRenamed, this); |
| 69 | 70 |
| 70 this._sourcesView = new WebInspector.SourcesView(this._workspace, this); | 71 this._sourcesView = new WebInspector.SourcesView(this._workspace, this); |
| 71 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); | 72 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); |
| 72 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); | 73 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); |
| 73 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); | 74 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); |
| 74 this.editorView.setMainWidget(this._sourcesView); | 75 this.editorView.setMainWidget(this._sourcesView); |
| 75 | 76 |
| 76 this.sidebarPanes = {}; | 77 this.sidebarPanes = {}; |
| 77 this.sidebarPanes.threads = new WebInspector.ThreadsSidebarPane(); | 78 this.sidebarPanes.threads = null; |
| 78 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba
rPane(); | 79 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba
rPane(); |
| 79 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); | 80 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); |
| 80 this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPa
ne.Events.CallFrameSelected, this._callFrameSelectedInSidebar.bind(this)); | 81 this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPa
ne.Events.CallFrameSelected, this._callFrameSelectedInSidebar.bind(this)); |
| 81 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th
is)); | 82 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th
is)); |
| 82 | 83 |
| 83 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); | 84 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); |
| 84 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide
barPane(WebInspector.breakpointManager, this.showUISourceCode.bind(this)); | 85 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide
barPane(WebInspector.breakpointManager, this.showUISourceCode.bind(this)); |
| 85 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); | 86 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); |
| 86 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan
e(); | 87 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan
e(); |
| 87 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB
reakpointsSidebarPane(); | 88 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB
reakpointsSidebarPane(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 105 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu
rrentTargetChanged, this); | 106 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu
rrentTargetChanged, this); |
| 106 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this
); | 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this
); |
| 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); | 108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
| 108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); | 109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); |
| 109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.CallFrameSelected, this._callFrameSelected, this); | 110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.CallFrameSelected, this._callFrameSelected, this); |
| 110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame, this._
consoleCommandEvaluatedInSelectedCallFrame, this); | 111 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame, this._
consoleCommandEvaluatedInSelectedCallFrame, this); |
| 111 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); | 112 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
| 112 new WebInspector.WorkspaceMappingTip(this, this._workspace); | 113 new WebInspector.WorkspaceMappingTip(this, this._workspace); |
| 113 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); | 114 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); |
| 114 WebInspector.DataSaverInfobar.maybeShowInPanel(this); | 115 WebInspector.DataSaverInfobar.maybeShowInPanel(this); |
| 116 WebInspector.targetManager.observeTargets(this); |
| 115 } | 117 } |
| 116 | 118 |
| 117 WebInspector.SourcesPanel._lastModificationTimeout = 200; | 119 WebInspector.SourcesPanel._lastModificationTimeout = 200; |
| 118 | 120 |
| 119 WebInspector.SourcesPanel.minToolbarWidth = 215; | 121 WebInspector.SourcesPanel.minToolbarWidth = 215; |
| 120 | 122 |
| 121 WebInspector.SourcesPanel.prototype = { | 123 WebInspector.SourcesPanel.prototype = { |
| 122 /** | 124 /** |
| 125 * @override |
| 126 * @param {!WebInspector.Target} target |
| 127 */ |
| 128 targetAdded: function(target) |
| 129 { |
| 130 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target.
Capability.JS).length > 1; |
| 131 if (hasThreads && !this.sidebarPanes.threads) { |
| 132 this.sidebarPanes.threads = new WebInspector.ThreadsSidebarPane(); |
| 133 if (this._sidebarPaneStack) { |
| 134 this._sidebarPaneStack.insertViewBefore(this.sidebarPanes.thread
s, this._splitWidget.isVertical() ? this.sidebarPanes.watchExpressions : this.si
debarPanes.callstack, true); |
| 135 } |
| 136 } |
| 137 }, |
| 138 |
| 139 /** |
| 140 * @override |
| 141 * @param {!WebInspector.Target} target |
| 142 */ |
| 143 targetRemoved: function(target) |
| 144 { |
| 145 }, |
| 146 |
| 147 /** |
| 123 * @param {?WebInspector.Target} target | 148 * @param {?WebInspector.Target} target |
| 124 */ | 149 */ |
| 125 _setTarget: function(target) | 150 _setTarget: function(target) |
| 126 { | 151 { |
| 127 if (!target) | 152 if (!target) |
| 128 return; | 153 return; |
| 129 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 154 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 130 if (!debuggerModel) | 155 if (!debuggerModel) |
| 131 return; | 156 return; |
| 132 | 157 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 | 1110 |
| 1086 this._splitWidget.setVertical(!vertically); | 1111 this._splitWidget.setVertical(!vertically); |
| 1087 this._splitWidget.element.classList.toggle("sources-split-view-vertical"
, vertically); | 1112 this._splitWidget.element.classList.toggle("sources-split-view-vertical"
, vertically); |
| 1088 | 1113 |
| 1089 WebInspector.SourcesPanel.updateResizer(this); | 1114 WebInspector.SourcesPanel.updateResizer(this); |
| 1090 | 1115 |
| 1091 // Create vertical box with stack. | 1116 // Create vertical box with stack. |
| 1092 var vbox = new WebInspector.VBox(); | 1117 var vbox = new WebInspector.VBox(); |
| 1093 vbox.element.appendChild(this._debugToolbarDrawer); | 1118 vbox.element.appendChild(this._debugToolbarDrawer); |
| 1094 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); | 1119 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); |
| 1095 var sidebarPaneStack = new WebInspector.SidebarPaneStack(); | 1120 this._sidebarPaneStack = new WebInspector.View.ExpandableStackContainer(
); |
| 1096 sidebarPaneStack.element.classList.add("flex-auto"); | 1121 this._sidebarPaneStack.show(vbox.element); |
| 1097 sidebarPaneStack.show(vbox.element); | |
| 1098 vbox.element.appendChild(this._debugToolbar.element); | 1122 vbox.element.appendChild(this._debugToolbar.element); |
| 1099 | 1123 |
| 1100 if (!vertically) { | 1124 if (!vertically) { |
| 1101 // Populate the only stack. | 1125 // Populate the only stack. |
| 1102 for (var pane in this.sidebarPanes) | 1126 for (var pane in this.sidebarPanes) { |
| 1103 sidebarPaneStack.addPane(this.sidebarPanes[pane]); | 1127 if (this.sidebarPanes[pane]) |
| 1104 this._extensionSidebarPanesContainer = sidebarPaneStack; | 1128 this._sidebarPaneStack.appendView(this.sidebarPanes[pane]); |
| 1129 } |
| 1130 this._extensionSidebarPanesContainer = this._sidebarPaneStack; |
| 1105 this.sidebarPaneView = vbox; | 1131 this.sidebarPaneView = vbox; |
| 1106 | 1132 |
| 1107 this.sidebarPanes.scopechain.requestReveal(); | 1133 this.sidebarPanes.scopechain.revealWidget(); |
| 1108 this.sidebarPanes.watchExpressions.expandIfNecessary(); | 1134 this.sidebarPanes.watchExpressions.expandIfNecessary(); |
| 1109 } else { | 1135 } else { |
| 1110 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP
anelDebuggerSidebarSplitViewState", 0.5); | 1136 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP
anelDebuggerSidebarSplitViewState", 0.5); |
| 1111 splitWidget.setMainWidget(vbox); | 1137 splitWidget.setMainWidget(vbox); |
| 1112 | 1138 |
| 1113 // Populate the left stack. | 1139 // Populate the left stack. |
| 1114 sidebarPaneStack.addPane(this.sidebarPanes.threads); | 1140 if (this.sidebarPanes.threads) |
| 1115 sidebarPaneStack.addPane(this.sidebarPanes.callstack); | 1141 this._sidebarPaneStack.appendView(this.sidebarPanes.threads); |
| 1116 sidebarPaneStack.addPane(this.sidebarPanes.jsBreakpoints); | 1142 this._sidebarPaneStack.appendView(this.sidebarPanes.callstack); |
| 1117 sidebarPaneStack.addPane(this.sidebarPanes.domBreakpoints); | 1143 this._sidebarPaneStack.appendView(this.sidebarPanes.jsBreakpoints); |
| 1118 sidebarPaneStack.addPane(this.sidebarPanes.xhrBreakpoints); | 1144 this._sidebarPaneStack.appendView(this.sidebarPanes.domBreakpoints); |
| 1119 sidebarPaneStack.addPane(this.sidebarPanes.eventListenerBreakpoints)
; | 1145 this._sidebarPaneStack.appendView(this.sidebarPanes.xhrBreakpoints); |
| 1120 sidebarPaneStack.addPane(this.sidebarPanes.objectEventListeners); | 1146 this._sidebarPaneStack.appendView(this.sidebarPanes.eventListenerBre
akpoints); |
| 1147 this._sidebarPaneStack.appendView(this.sidebarPanes.objectEventListe
ners); |
| 1121 | 1148 |
| 1122 var tabbedPane = new WebInspector.SidebarTabbedPane(); | 1149 var tabbedPane = new WebInspector.View.TabbedPaneContainer(); |
| 1123 splitWidget.setSidebarWidget(tabbedPane); | 1150 splitWidget.setSidebarWidget(tabbedPane); |
| 1124 tabbedPane.addPane(this.sidebarPanes.scopechain); | 1151 tabbedPane.appendView(this.sidebarPanes.scopechain); |
| 1125 tabbedPane.addPane(this.sidebarPanes.watchExpressions); | 1152 tabbedPane.appendView(this.sidebarPanes.watchExpressions); |
| 1126 if (this.sidebarPanes.serviceWorkers) | 1153 if (this.sidebarPanes.serviceWorkers) |
| 1127 tabbedPane.addPane(this.sidebarPanes.serviceWorkers); | 1154 tabbedPane.appendView(this.sidebarPanes.serviceWorkers); |
| 1128 tabbedPane.selectTab(this._lastSelectedTabSetting.get()); | 1155 tabbedPane.selectTab(this._lastSelectedTabSetting.get()); |
| 1129 tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSe
lected, this._tabSelected, this); | 1156 tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSe
lected, this._tabSelected, this); |
| 1130 this._extensionSidebarPanesContainer = tabbedPane; | 1157 this._extensionSidebarPanesContainer = tabbedPane; |
| 1131 this.sidebarPaneView = splitWidget; | 1158 this.sidebarPaneView = splitWidget; |
| 1132 } | 1159 } |
| 1133 | 1160 |
| 1134 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); | 1161 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); |
| 1135 for (var i = 0; i < extensionSidebarPanes.length; ++i) | 1162 for (var i = 0; i < extensionSidebarPanes.length; ++i) |
| 1136 this._addExtensionSidebarPane(extensionSidebarPanes[i]); | 1163 this._addExtensionSidebarPane(extensionSidebarPanes[i]); |
| 1137 | 1164 |
| 1138 this._splitWidget.setSidebarWidget(this.sidebarPaneView); | 1165 this._splitWidget.setSidebarWidget(this.sidebarPaneView); |
| 1139 this.sidebarPanes.threads.requestReveal(); | 1166 if (this.sidebarPanes.threads) |
| 1140 this.sidebarPanes.jsBreakpoints.requestReveal(); | 1167 this.sidebarPanes.threads.revealWidget(); |
| 1141 this.sidebarPanes.callstack.requestReveal(); | 1168 this.sidebarPanes.jsBreakpoints.revealWidget(); |
| 1169 this.sidebarPanes.callstack.revealWidget(); |
| 1142 }, | 1170 }, |
| 1143 | 1171 |
| 1144 /** | 1172 /** |
| 1145 * @param {!WebInspector.Event} event | 1173 * @param {!WebInspector.Event} event |
| 1146 */ | 1174 */ |
| 1147 _tabSelected: function(event) | 1175 _tabSelected: function(event) |
| 1148 { | 1176 { |
| 1149 this._lastSelectedTabSetting.set(event.data.tabId); | 1177 this._lastSelectedTabSetting.set(event.data.tabId); |
| 1150 }, | 1178 }, |
| 1151 | 1179 |
| 1152 /** | 1180 /** |
| 1153 * @param {!WebInspector.Event} event | 1181 * @param {!WebInspector.Event} event |
| 1154 */ | 1182 */ |
| 1155 _extensionSidebarPaneAdded: function(event) | 1183 _extensionSidebarPaneAdded: function(event) |
| 1156 { | 1184 { |
| 1157 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data
); | 1185 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data
); |
| 1158 this._addExtensionSidebarPane(pane); | 1186 this._addExtensionSidebarPane(pane); |
| 1159 }, | 1187 }, |
| 1160 | 1188 |
| 1161 /** | 1189 /** |
| 1162 * @param {!WebInspector.ExtensionSidebarPane} pane | 1190 * @param {!WebInspector.ExtensionSidebarPane} pane |
| 1163 */ | 1191 */ |
| 1164 _addExtensionSidebarPane: function(pane) | 1192 _addExtensionSidebarPane: function(pane) |
| 1165 { | 1193 { |
| 1166 if (pane.panelName() === this.name) | 1194 if (pane.panelName() === this.name) |
| 1167 this._extensionSidebarPanesContainer.addPane(pane); | 1195 this._extensionSidebarPanesContainer.appendView(pane); |
| 1168 }, | 1196 }, |
| 1169 | 1197 |
| 1170 /** | 1198 /** |
| 1171 * @return {!WebInspector.SourcesView} | 1199 * @return {!WebInspector.SourcesView} |
| 1172 */ | 1200 */ |
| 1173 sourcesView: function() | 1201 sourcesView: function() |
| 1174 { | 1202 { |
| 1175 return this._sourcesView; | 1203 return this._sourcesView; |
| 1176 }, | 1204 }, |
| 1177 | 1205 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 __proto__: WebInspector.VBox.prototype | 1498 __proto__: WebInspector.VBox.prototype |
| 1471 } | 1499 } |
| 1472 | 1500 |
| 1473 /** | 1501 /** |
| 1474 * @return {boolean} | 1502 * @return {boolean} |
| 1475 */ | 1503 */ |
| 1476 WebInspector.SourcesPanel.WrapperView.isShowing = function() | 1504 WebInspector.SourcesPanel.WrapperView.isShowing = function() |
| 1477 { | 1505 { |
| 1478 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); | 1506 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou
rcesPanel.WrapperView._instance.isShowing(); |
| 1479 } | 1507 } |
| OLD | NEW |