Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
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 * @implements {WebInspector.ContextMenu.Provider} 27 * @implements {UI.ContextMenu.Provider}
28 * @implements {WebInspector.TargetManager.Observer} 28 * @implements {SDK.TargetManager.Observer}
29 * @implements {WebInspector.ViewLocationResolver} 29 * @implements {UI.ViewLocationResolver}
30 * @unrestricted 30 * @unrestricted
31 */ 31 */
32 WebInspector.SourcesPanel = class extends WebInspector.Panel { 32 Sources.SourcesPanel = class extends UI.Panel {
33 constructor() { 33 constructor() {
34 super('sources'); 34 super('sources');
35 WebInspector.SourcesPanel._instance = this; 35 Sources.SourcesPanel._instance = this;
36 this.registerRequiredCSS('sources/sourcesPanel.css'); 36 this.registerRequiredCSS('sources/sourcesPanel.css');
37 new WebInspector.DropTarget( 37 new UI.DropTarget(
38 this.element, [WebInspector.DropTarget.Types.Files], WebInspector.UIStri ng('Drop workspace folder here'), 38 this.element, [UI.DropTarget.Types.Files], Common.UIString('Drop workspa ce folder here'),
39 this._handleDrop.bind(this)); 39 this._handleDrop.bind(this));
40 40
41 this._workspace = WebInspector.workspace; 41 this._workspace = Workspace.workspace;
42 this._networkMapping = WebInspector.networkMapping; 42 this._networkMapping = Bindings.networkMapping;
43 43
44 this._togglePauseAction = 44 this._togglePauseAction =
45 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-pause')); 45 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-pau se'));
46 this._stepOverAction = 46 this._stepOverAction =
47 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-over')); 47 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-over' ));
48 this._stepIntoAction = 48 this._stepIntoAction =
49 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-into')); 49 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.step-into' ));
50 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action('debugger.step-out')); 50 this._stepOutAction = /** @type {!UI.Action }*/ (UI.actionRegistry.action('d ebugger.step-out'));
51 this._toggleBreakpointsActiveAction = 51 this._toggleBreakpointsActiveAction =
52 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-breakpoints-active')); 52 /** @type {!UI.Action }*/ (UI.actionRegistry.action('debugger.toggle-bre akpoints-active'));
53 53
54 this._debugToolbar = this._createDebugToolbar(); 54 this._debugToolbar = this._createDebugToolbar();
55 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); 55 this._debugToolbarDrawer = this._createDebugToolbarDrawer();
56 this._debuggerPausedMessage = new WebInspector.DebuggerPausedMessage(); 56 this._debuggerPausedMessage = new Sources.DebuggerPausedMessage();
57 57
58 const initialDebugSidebarWidth = 225; 58 const initialDebugSidebarWidth = 225;
59 this._splitWidget = 59 this._splitWidget =
60 new WebInspector.SplitWidget(true, true, 'sourcesPanelSplitViewState', i nitialDebugSidebarWidth); 60 new UI.SplitWidget(true, true, 'sourcesPanelSplitViewState', initialDebu gSidebarWidth);
61 this._splitWidget.enableShowModeSaving(); 61 this._splitWidget.enableShowModeSaving();
62 this._splitWidget.show(this.element); 62 this._splitWidget.show(this.element);
63 63
64 // Create scripts navigator 64 // Create scripts navigator
65 const initialNavigatorWidth = 225; 65 const initialNavigatorWidth = 225;
66 this.editorView = 66 this.editorView =
67 new WebInspector.SplitWidget(true, false, 'sourcesPanelNavigatorSplitVie wState', initialNavigatorWidth); 67 new UI.SplitWidget(true, false, 'sourcesPanelNavigatorSplitViewState', i nitialNavigatorWidth);
68 this.editorView.enableShowModeSaving(); 68 this.editorView.enableShowModeSaving();
69 this.editorView.element.tabIndex = 0; 69 this.editorView.element.tabIndex = 0;
70 this._splitWidget.setMainWidget(this.editorView); 70 this._splitWidget.setMainWidget(this.editorView);
71 71
72 // Create navigator tabbed pane with toolbar. 72 // Create navigator tabbed pane with toolbar.
73 this._navigatorTabbedLocation = 73 this._navigatorTabbedLocation =
74 WebInspector.viewManager.createTabbedLocation(this._revealNavigatorSideb ar.bind(this), 'navigator-view', true); 74 UI.viewManager.createTabbedLocation(this._revealNavigatorSidebar.bind(th is), 'navigator-view', true);
75 var tabbedPane = this._navigatorTabbedLocation.tabbedPane(); 75 var tabbedPane = this._navigatorTabbedLocation.tabbedPane();
76 tabbedPane.setMinimumSize(100, 25); 76 tabbedPane.setMinimumSize(100, 25);
77 tabbedPane.element.classList.add('navigator-tabbed-pane'); 77 tabbedPane.element.classList.add('navigator-tabbed-pane');
78 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true); 78 var navigatorMenuButton = new UI.ToolbarMenuButton(this._populateNavigatorMe nu.bind(this), true);
79 navigatorMenuButton.setTitle(WebInspector.UIString('More options')); 79 navigatorMenuButton.setTitle(Common.UIString('More options'));
80 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton); 80 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton);
81 this.editorView.setSidebarWidget(tabbedPane); 81 this.editorView.setSidebarWidget(tabbedPane);
82 82
83 this._sourcesView = new WebInspector.SourcesView(); 83 this._sourcesView = new Sources.SourcesView();
84 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); 84 this._sourcesView.addEventListener(Sources.SourcesView.Events.EditorSelected , this._editorSelected.bind(this));
85 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); 85 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this));
86 86
87 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu tton('navigator'); 87 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu tton('navigator');
88 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB utton('debugger'); 88 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB utton('debugger');
89 this.editorView.setMainWidget(this._sourcesView); 89 this.editorView.setMainWidget(this._sourcesView);
90 90
91 this._threadsSidebarPane = null; 91 this._threadsSidebarPane = null;
92 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view('sources.watch')); 92 this._watchSidebarPane = /** @type {!UI.View} */ (UI.viewManager.view('sourc es.watch'));
93 // TODO: Force installing listeners from the model, not the UI. 93 // TODO: Force installing listeners from the model, not the UI.
94 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); 94 self.runtime.sharedInstance(Sources.XHRBreakpointsSidebarPane);
95 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane); 95 this._callstackPane = self.runtime.sharedInstance(Sources.CallStackSidebarPa ne);
96 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); 96 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this));
97 97
98 WebInspector.moduleSetting('sidebarPosition').addChangeListener(this._update SidebarPosition.bind(this)); 98 Common.moduleSetting('sidebarPosition').addChangeListener(this._updateSideba rPosition.bind(this));
99 this._updateSidebarPosition(); 99 this._updateSidebarPosition();
100 100
101 this._updateDebuggerButtonsAndStatus(); 101 this._updateDebuggerButtonsAndStatus();
102 this._pauseOnExceptionEnabledChanged(); 102 this._pauseOnExceptionEnabledChanged();
103 WebInspector.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this ._pauseOnExceptionEnabledChanged, this); 103 Common.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this._paus eOnExceptionEnabledChanged, this);
104 104
105 this._liveLocationPool = new WebInspector.LiveLocationPool(); 105 this._liveLocationPool = new Bindings.LiveLocationPool();
106 106
107 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); 107 this._setTarget(UI.context.flavor(SDK.Target));
108 WebInspector.breakpointManager.addEventListener( 108 Bindings.breakpointManager.addEventListener(
109 WebInspector.BreakpointManager.Events.BreakpointsActiveStateChanged, thi s._breakpointsActiveStateChanged, this); 109 Bindings.BreakpointManager.Events.BreakpointsActiveStateChanged, this._b reakpointsActiveStateChanged, this);
110 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); 110 UI.context.addFlavorChangeListener(SDK.Target, this._onCurrentTargetChanged, this);
111 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this); 111 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this._callFr ameChanged, this);
112 WebInspector.targetManager.addModelListener( 112 SDK.targetManager.addModelListener(
113 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerWa sEnabled, this._debuggerWasEnabled, 113 SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerWasEnabled, this._de buggerWasEnabled,
114 this); 114 this);
115 WebInspector.targetManager.addModelListener( 115 SDK.targetManager.addModelListener(
116 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerPa used, this._debuggerPaused, this); 116 SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerPaused, this._debugg erPaused, this);
117 WebInspector.targetManager.addModelListener( 117 SDK.targetManager.addModelListener(
118 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerRe sumed, this._debuggerResumed, this); 118 SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerResumed, this._debug gerResumed, this);
119 WebInspector.targetManager.addModelListener( 119 SDK.targetManager.addModelListener(
120 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.GlobalObje ctCleared, this._debuggerReset, this); 120 SDK.DebuggerModel, SDK.DebuggerModel.Events.GlobalObjectCleared, this._d ebuggerReset, this);
121 WebInspector.targetManager.addModelListener( 121 SDK.targetManager.addModelListener(
122 WebInspector.SubTargetsManager, WebInspector.SubTargetsManager.Events.Pe ndingTargetAdded, this._pendingTargetAdded, this); 122 SDK.SubTargetsManager, SDK.SubTargetsManager.Events.PendingTargetAdded, this._pendingTargetAdded, this);
123 new WebInspector.WorkspaceMappingTip(this, this._workspace); 123 new Sources.WorkspaceMappingTip(this, this._workspace);
124 WebInspector.extensionServer.addEventListener( 124 Extensions.extensionServer.addEventListener(
125 WebInspector.ExtensionServer.Events.SidebarPaneAdded, this._extensionSid ebarPaneAdded, this); 125 Extensions.ExtensionServer.Events.SidebarPaneAdded, this._extensionSideb arPaneAdded, this);
126 WebInspector.DataSaverInfobar.maybeShowInPanel(this); 126 Components.DataSaverInfobar.maybeShowInPanel(this);
127 WebInspector.targetManager.observeTargets(this); 127 SDK.targetManager.observeTargets(this);
128 } 128 }
129 129
130 /** 130 /**
131 * @return {!WebInspector.SourcesPanel} 131 * @return {!Sources.SourcesPanel}
132 */ 132 */
133 static instance() { 133 static instance() {
134 if (WebInspector.SourcesPanel._instance) 134 if (Sources.SourcesPanel._instance)
135 return WebInspector.SourcesPanel._instance; 135 return Sources.SourcesPanel._instance;
136 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc e(WebInspector.SourcesPanel)); 136 return /** @type {!Sources.SourcesPanel} */ (self.runtime.sharedInstance(Sou rces.SourcesPanel));
137 } 137 }
138 138
139 /** 139 /**
140 * @param {!WebInspector.SourcesPanel} panel 140 * @param {!Sources.SourcesPanel} panel
141 */ 141 */
142 static updateResizerAndSidebarButtons(panel) { 142 static updateResizerAndSidebarButtons(panel) {
143 panel._sourcesView.leftToolbar().removeToolbarItems(); 143 panel._sourcesView.leftToolbar().removeToolbarItems();
144 panel._sourcesView.rightToolbar().removeToolbarItems(); 144 panel._sourcesView.rightToolbar().removeToolbarItems();
145 panel._sourcesView.bottomToolbar().removeToolbarItems(); 145 panel._sourcesView.bottomToolbar().removeToolbarItems();
146 var isInWrapper = 146 var isInWrapper =
147 WebInspector.SourcesPanel.WrapperView.isShowing() && !WebInspector.inspe ctorView.isDrawerMinimized(); 147 Sources.SourcesPanel.WrapperView.isShowing() && !UI.inspectorView.isDraw erMinimized();
148 if (panel._splitWidget.isVertical() || isInWrapper) 148 if (panel._splitWidget.isVertical() || isInWrapper)
149 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerEle ment()); 149 panel._splitWidget.uninstallResizer(panel._sourcesView.toolbarContainerEle ment());
150 else 150 else
151 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEleme nt()); 151 panel._splitWidget.installResizer(panel._sourcesView.toolbarContainerEleme nt());
152 if (!isInWrapper) { 152 if (!isInWrapper) {
153 panel._sourcesView.leftToolbar().appendToolbarItem(panel._toggleNavigatorS idebarButton); 153 panel._sourcesView.leftToolbar().appendToolbarItem(panel._toggleNavigatorS idebarButton);
154 if (panel._splitWidget.isVertical()) 154 if (panel._splitWidget.isVertical())
155 panel._sourcesView.rightToolbar().appendToolbarItem(panel._toggleDebugge rSidebarButton); 155 panel._sourcesView.rightToolbar().appendToolbarItem(panel._toggleDebugge rSidebarButton);
156 else 156 else
157 panel._sourcesView.bottomToolbar().appendToolbarItem(panel._toggleDebugg erSidebarButton); 157 panel._sourcesView.bottomToolbar().appendToolbarItem(panel._toggleDebugg erSidebarButton);
158 } 158 }
159 } 159 }
160 160
161 /** 161 /**
162 * @override 162 * @override
163 * @param {!WebInspector.Target} target 163 * @param {!SDK.Target} target
164 */ 164 */
165 targetAdded(target) { 165 targetAdded(target) {
166 this._showThreadsIfNeeded(); 166 this._showThreadsIfNeeded();
167 } 167 }
168 168
169 /** 169 /**
170 * @override 170 * @override
171 * @param {!WebInspector.Target} target 171 * @param {!SDK.Target} target
172 */ 172 */
173 targetRemoved(target) { 173 targetRemoved(target) {
174 } 174 }
175 175
176 _pendingTargetAdded() { 176 _pendingTargetAdded() {
177 this._showThreadsIfNeeded(); 177 this._showThreadsIfNeeded();
178 } 178 }
179 179
180 _showThreadsIfNeeded() { 180 _showThreadsIfNeeded() {
181 if (WebInspector.ThreadsSidebarPane.shouldBeShown() && !this._threadsSidebar Pane) { 181 if (Sources.ThreadsSidebarPane.shouldBeShown() && !this._threadsSidebarPane) {
182 this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebInspector .viewManager.view('sources.threads')); 182 this._threadsSidebarPane = /** @type {!UI.View} */ (UI.viewManager.view('s ources.threads'));
183 if (this._sidebarPaneStack) 183 if (this._sidebarPaneStack)
184 this._sidebarPaneStack.showView(this._threadsSidebarPane, this._splitWid get.isVertical() ? this._watchSidebarPane : this._callstackPane); 184 this._sidebarPaneStack.showView(this._threadsSidebarPane, this._splitWid get.isVertical() ? this._watchSidebarPane : this._callstackPane);
185 } 185 }
186 } 186 }
187 187
188 188
189 /** 189 /**
190 * @param {?WebInspector.Target} target 190 * @param {?SDK.Target} target
191 */ 191 */
192 _setTarget(target) { 192 _setTarget(target) {
193 if (!target) 193 if (!target)
194 return; 194 return;
195 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 195 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
196 if (!debuggerModel) 196 if (!debuggerModel)
197 return; 197 return;
198 198
199 if (debuggerModel.isPaused()) { 199 if (debuggerModel.isPaused()) {
200 this._showDebuggerPausedDetails( 200 this._showDebuggerPausedDetails(
201 /** @type {!WebInspector.DebuggerPausedDetails} */ (debuggerModel.debu ggerPausedDetails())); 201 /** @type {!SDK.DebuggerPausedDetails} */ (debuggerModel.debuggerPause dDetails()));
202 } else { 202 } else {
203 this._paused = false; 203 this._paused = false;
204 this._clearInterface(); 204 this._clearInterface();
205 this._toggleDebuggerSidebarButton.setEnabled(true); 205 this._toggleDebuggerSidebarButton.setEnabled(true);
206 } 206 }
207 } 207 }
208 208
209 /** 209 /**
210 * @param {!WebInspector.Event} event 210 * @param {!Common.Event} event
211 */ 211 */
212 _onCurrentTargetChanged(event) { 212 _onCurrentTargetChanged(event) {
213 var target = /** @type {?WebInspector.Target} */ (event.data); 213 var target = /** @type {?SDK.Target} */ (event.data);
214 this._setTarget(target); 214 this._setTarget(target);
215 } 215 }
216 /** 216 /**
217 * @return {boolean} 217 * @return {boolean}
218 */ 218 */
219 paused() { 219 paused() {
220 return this._paused; 220 return this._paused;
221 } 221 }
222 222
223 /** 223 /**
224 * @override 224 * @override
225 */ 225 */
226 wasShown() { 226 wasShown() {
227 WebInspector.context.setFlavor(WebInspector.SourcesPanel, this); 227 UI.context.setFlavor(Sources.SourcesPanel, this);
228 super.wasShown(); 228 super.wasShown();
229 var wrapper = WebInspector.SourcesPanel.WrapperView._instance; 229 var wrapper = Sources.SourcesPanel.WrapperView._instance;
230 if (wrapper && wrapper.isShowing()) { 230 if (wrapper && wrapper.isShowing()) {
231 WebInspector.inspectorView.setDrawerMinimized(true); 231 UI.inspectorView.setDrawerMinimized(true);
232 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); 232 Sources.SourcesPanel.updateResizerAndSidebarButtons(this);
233 } 233 }
234 this.editorView.setMainWidget(this._sourcesView); 234 this.editorView.setMainWidget(this._sourcesView);
235 } 235 }
236 236
237 /** 237 /**
238 * @override 238 * @override
239 */ 239 */
240 willHide() { 240 willHide() {
241 super.willHide(); 241 super.willHide();
242 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); 242 UI.context.setFlavor(Sources.SourcesPanel, null);
243 if (WebInspector.SourcesPanel.WrapperView.isShowing()) { 243 if (Sources.SourcesPanel.WrapperView.isShowing()) {
244 WebInspector.SourcesPanel.WrapperView._instance._showViewInWrapper(); 244 Sources.SourcesPanel.WrapperView._instance._showViewInWrapper();
245 WebInspector.inspectorView.setDrawerMinimized(false); 245 UI.inspectorView.setDrawerMinimized(false);
246 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); 246 Sources.SourcesPanel.updateResizerAndSidebarButtons(this);
247 } 247 }
248 } 248 }
249 249
250 /** 250 /**
251 * @override 251 * @override
252 * @param {string} locationName 252 * @param {string} locationName
253 * @return {?WebInspector.ViewLocation} 253 * @return {?UI.ViewLocation}
254 */ 254 */
255 resolveLocation(locationName) { 255 resolveLocation(locationName) {
256 if (locationName === 'sources-sidebar') 256 if (locationName === 'sources-sidebar')
257 return this._sidebarPaneStack; 257 return this._sidebarPaneStack;
258 else 258 else
259 return this._navigatorTabbedLocation; 259 return this._navigatorTabbedLocation;
260 } 260 }
261 261
262 /** 262 /**
263 * @return {boolean} 263 * @return {boolean}
264 */ 264 */
265 _ensureSourcesViewVisible() { 265 _ensureSourcesViewVisible() {
266 if (WebInspector.SourcesPanel.WrapperView.isShowing()) 266 if (Sources.SourcesPanel.WrapperView.isShowing())
267 return true; 267 return true;
268 if (!WebInspector.inspectorView.canSelectPanel('sources')) 268 if (!UI.inspectorView.canSelectPanel('sources'))
269 return false; 269 return false;
270 WebInspector.viewManager.showView('sources'); 270 UI.viewManager.showView('sources');
271 return true; 271 return true;
272 } 272 }
273 273
274 /** 274 /**
275 * @override 275 * @override
276 */ 276 */
277 onResize() { 277 onResize() {
278 if (WebInspector.moduleSetting('sidebarPosition').get() === 'auto') 278 if (Common.moduleSetting('sidebarPosition').get() === 'auto')
279 this.element.window().requestAnimationFrame(this._updateSidebarPosition.bi nd(this)); // Do not force layout. 279 this.element.window().requestAnimationFrame(this._updateSidebarPosition.bi nd(this)); // Do not force layout.
280 } 280 }
281 281
282 /** 282 /**
283 * @override 283 * @override
284 * @return {!WebInspector.SearchableView} 284 * @return {!UI.SearchableView}
285 */ 285 */
286 searchableView() { 286 searchableView() {
287 return this._sourcesView.searchableView(); 287 return this._sourcesView.searchableView();
288 } 288 }
289 289
290 /** 290 /**
291 * @param {!WebInspector.Event} event 291 * @param {!Common.Event} event
292 */ 292 */
293 _debuggerPaused(event) { 293 _debuggerPaused(event) {
294 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event.data ); 294 var details = /** @type {!SDK.DebuggerPausedDetails} */ (event.data);
295 if (!this._paused) 295 if (!this._paused)
296 this._setAsCurrentPanel(); 296 this._setAsCurrentPanel();
297 297
298 if (WebInspector.context.flavor(WebInspector.Target) === details.target()) 298 if (UI.context.flavor(SDK.Target) === details.target())
299 this._showDebuggerPausedDetails(details); 299 this._showDebuggerPausedDetails(details);
300 else if (!this._paused) 300 else if (!this._paused)
301 WebInspector.context.setFlavor(WebInspector.Target, details.target()); 301 UI.context.setFlavor(SDK.Target, details.target());
302 } 302 }
303 303
304 /** 304 /**
305 * @param {!WebInspector.DebuggerPausedDetails} details 305 * @param {!SDK.DebuggerPausedDetails} details
306 */ 306 */
307 _showDebuggerPausedDetails(details) { 307 _showDebuggerPausedDetails(details) {
308 this._paused = true; 308 this._paused = true;
309 this._updateDebuggerButtonsAndStatus(); 309 this._updateDebuggerButtonsAndStatus();
310 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, details); 310 UI.context.setFlavor(SDK.DebuggerPausedDetails, details);
311 this._toggleDebuggerSidebarButton.setEnabled(false); 311 this._toggleDebuggerSidebarButton.setEnabled(false);
312 window.focus(); 312 window.focus();
313 InspectorFrontendHost.bringToFront(); 313 InspectorFrontendHost.bringToFront();
314 } 314 }
315 315
316 /** 316 /**
317 * @param {!WebInspector.Event} event 317 * @param {!Common.Event} event
318 */ 318 */
319 _debuggerResumed(event) { 319 _debuggerResumed(event) {
320 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.target ); 320 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.target);
321 var target = debuggerModel.target(); 321 var target = debuggerModel.target();
322 if (WebInspector.context.flavor(WebInspector.Target) !== target) 322 if (UI.context.flavor(SDK.Target) !== target)
323 return; 323 return;
324 this._paused = false; 324 this._paused = false;
325 this._clearInterface(); 325 this._clearInterface();
326 this._toggleDebuggerSidebarButton.setEnabled(true); 326 this._toggleDebuggerSidebarButton.setEnabled(true);
327 this._switchToPausedTargetTimeout = setTimeout(this._switchToPausedTarget.bi nd(this, debuggerModel), 500); 327 this._switchToPausedTargetTimeout = setTimeout(this._switchToPausedTarget.bi nd(this, debuggerModel), 500);
328 } 328 }
329 329
330 /** 330 /**
331 * @param {!WebInspector.Event} event 331 * @param {!Common.Event} event
332 */ 332 */
333 _debuggerWasEnabled(event) { 333 _debuggerWasEnabled(event) {
334 var target = /** @type {!WebInspector.Target} */ (event.target.target()); 334 var target = /** @type {!SDK.Target} */ (event.target.target());
335 if (WebInspector.context.flavor(WebInspector.Target) !== target) 335 if (UI.context.flavor(SDK.Target) !== target)
336 return; 336 return;
337 337
338 this._updateDebuggerButtonsAndStatus(); 338 this._updateDebuggerButtonsAndStatus();
339 } 339 }
340 340
341 /** 341 /**
342 * @param {!WebInspector.Event} event 342 * @param {!Common.Event} event
343 */ 343 */
344 _debuggerReset(event) { 344 _debuggerReset(event) {
345 this._debuggerResumed(event); 345 this._debuggerResumed(event);
346 } 346 }
347 347
348 /** 348 /**
349 * @return {?WebInspector.Widget} 349 * @return {?UI.Widget}
350 */ 350 */
351 get visibleView() { 351 get visibleView() {
352 return this._sourcesView.visibleView(); 352 return this._sourcesView.visibleView();
353 } 353 }
354 354
355 /** 355 /**
356 * @param {!WebInspector.UISourceCode} uiSourceCode 356 * @param {!Workspace.UISourceCode} uiSourceCode
357 * @param {number=} lineNumber 0-based 357 * @param {number=} lineNumber 0-based
358 * @param {number=} columnNumber 358 * @param {number=} columnNumber
359 * @param {boolean=} omitFocus 359 * @param {boolean=} omitFocus
360 */ 360 */
361 showUISourceCode(uiSourceCode, lineNumber, columnNumber, omitFocus) { 361 showUISourceCode(uiSourceCode, lineNumber, columnNumber, omitFocus) {
362 if (omitFocus) { 362 if (omitFocus) {
363 var wrapperShowing = WebInspector.SourcesPanel.WrapperView._instance && 363 var wrapperShowing = Sources.SourcesPanel.WrapperView._instance &&
364 WebInspector.SourcesPanel.WrapperView._instance.isShowing(); 364 Sources.SourcesPanel.WrapperView._instance.isShowing();
365 if (!this.isShowing() && !wrapperShowing) 365 if (!this.isShowing() && !wrapperShowing)
366 return; 366 return;
367 } else { 367 } else {
368 this._showEditor(); 368 this._showEditor();
369 } 369 }
370 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber, omitFocus); 370 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber, omitFocus);
371 } 371 }
372 372
373 _showEditor() { 373 _showEditor() {
374 if (WebInspector.SourcesPanel.WrapperView._instance && WebInspector.SourcesP anel.WrapperView._instance.isShowing()) 374 if (Sources.SourcesPanel.WrapperView._instance && Sources.SourcesPanel.Wrapp erView._instance.isShowing())
375 return; 375 return;
376 this._setAsCurrentPanel(); 376 this._setAsCurrentPanel();
377 } 377 }
378 378
379 /** 379 /**
380 * @param {!WebInspector.UILocation} uiLocation 380 * @param {!Workspace.UILocation} uiLocation
381 * @param {boolean=} omitFocus 381 * @param {boolean=} omitFocus
382 */ 382 */
383 showUILocation(uiLocation, omitFocus) { 383 showUILocation(uiLocation, omitFocus) {
384 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, uiLoca tion.columnNumber, omitFocus); 384 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, uiLoca tion.columnNumber, omitFocus);
385 } 385 }
386 386
387 /** 387 /**
388 * @param {!WebInspector.UISourceCode} uiSourceCode 388 * @param {!Workspace.UISourceCode} uiSourceCode
389 * @param {boolean=} skipReveal 389 * @param {boolean=} skipReveal
390 */ 390 */
391 _revealInNavigator(uiSourceCode, skipReveal) { 391 _revealInNavigator(uiSourceCode, skipReveal) {
392 var binding = WebInspector.persistence.binding(uiSourceCode); 392 var binding = Persistence.persistence.binding(uiSourceCode);
393 if (binding && binding.network === uiSourceCode) 393 if (binding && binding.network === uiSourceCode)
394 uiSourceCode = binding.fileSystem; 394 uiSourceCode = binding.fileSystem;
395 395
396 var extensions = self.runtime.extensions(WebInspector.NavigatorView); 396 var extensions = self.runtime.extensions(Sources.NavigatorView);
397 Promise.all(extensions.map(extension => extension.instance())).then(filterNa vigators.bind(this)); 397 Promise.all(extensions.map(extension => extension.instance())).then(filterNa vigators.bind(this));
398 398
399 /** 399 /**
400 * @this {WebInspector.SourcesPanel} 400 * @this {Sources.SourcesPanel}
401 * @param {!Array.<!Object>} objects 401 * @param {!Array.<!Object>} objects
402 */ 402 */
403 function filterNavigators(objects) { 403 function filterNavigators(objects) {
404 for (var i = 0; i < objects.length; ++i) { 404 for (var i = 0; i < objects.length; ++i) {
405 var navigatorView = /** @type {!WebInspector.NavigatorView} */ (objects[ i]); 405 var navigatorView = /** @type {!Sources.NavigatorView} */ (objects[i]);
406 var viewId = extensions[i].descriptor()['viewId']; 406 var viewId = extensions[i].descriptor()['viewId'];
407 if (navigatorView.accept(uiSourceCode)) { 407 if (navigatorView.accept(uiSourceCode)) {
408 navigatorView.revealUISourceCode(uiSourceCode, true); 408 navigatorView.revealUISourceCode(uiSourceCode, true);
409 if (skipReveal) 409 if (skipReveal)
410 this._navigatorTabbedLocation.tabbedPane().selectTab(viewId); 410 this._navigatorTabbedLocation.tabbedPane().selectTab(viewId);
411 else 411 else
412 WebInspector.viewManager.showView(viewId); 412 UI.viewManager.showView(viewId);
413 } 413 }
414 } 414 }
415 } 415 }
416 } 416 }
417 417
418 /** 418 /**
419 * @param {!WebInspector.ContextMenu} contextMenu 419 * @param {!UI.ContextMenu} contextMenu
420 */ 420 */
421 _populateNavigatorMenu(contextMenu) { 421 _populateNavigatorMenu(contextMenu) {
422 var groupByFolderSetting = WebInspector.moduleSetting('navigatorGroupByFolde r'); 422 var groupByFolderSetting = Common.moduleSetting('navigatorGroupByFolder');
423 contextMenu.appendItemsAtLocation('navigatorMenu'); 423 contextMenu.appendItemsAtLocation('navigatorMenu');
424 contextMenu.appendSeparator(); 424 contextMenu.appendSeparator();
425 contextMenu.appendCheckboxItem( 425 contextMenu.appendCheckboxItem(
426 WebInspector.UIString('Group by folder'), () => groupByFolderSetting.set (!groupByFolderSetting.get()), 426 Common.UIString('Group by folder'), () => groupByFolderSetting.set(!grou pByFolderSetting.get()),
427 groupByFolderSetting.get()); 427 groupByFolderSetting.get());
428 } 428 }
429 429
430 /** 430 /**
431 * @param {boolean} ignoreExecutionLineEvents 431 * @param {boolean} ignoreExecutionLineEvents
432 */ 432 */
433 setIgnoreExecutionLineEvents(ignoreExecutionLineEvents) { 433 setIgnoreExecutionLineEvents(ignoreExecutionLineEvents) {
434 this._ignoreExecutionLineEvents = ignoreExecutionLineEvents; 434 this._ignoreExecutionLineEvents = ignoreExecutionLineEvents;
435 } 435 }
436 436
437 updateLastModificationTime() { 437 updateLastModificationTime() {
438 this._lastModificationTime = window.performance.now(); 438 this._lastModificationTime = window.performance.now();
439 } 439 }
440 440
441 /** 441 /**
442 * @param {!WebInspector.LiveLocation} liveLocation 442 * @param {!Bindings.LiveLocation} liveLocation
443 */ 443 */
444 _executionLineChanged(liveLocation) { 444 _executionLineChanged(liveLocation) {
445 var uiLocation = liveLocation.uiLocation(); 445 var uiLocation = liveLocation.uiLocation();
446 if (!uiLocation) 446 if (!uiLocation)
447 return; 447 return;
448 this._sourcesView.clearCurrentExecutionLine(); 448 this._sourcesView.clearCurrentExecutionLine();
449 this._sourcesView.setExecutionLocation(uiLocation); 449 this._sourcesView.setExecutionLocation(uiLocation);
450 if (window.performance.now() - this._lastModificationTime < WebInspector.Sou rcesPanel._lastModificationTimeout) 450 if (window.performance.now() - this._lastModificationTime < Sources.SourcesP anel._lastModificationTimeout)
451 return; 451 return;
452 this._sourcesView.showSourceLocation( 452 this._sourcesView.showSourceLocation(
453 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, undefined, true); 453 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, undefined, true);
454 } 454 }
455 455
456 _lastModificationTimeoutPassedForTest() { 456 _lastModificationTimeoutPassedForTest() {
457 WebInspector.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE; 457 Sources.SourcesPanel._lastModificationTimeout = Number.MIN_VALUE;
458 } 458 }
459 459
460 _updateLastModificationTimeForTest() { 460 _updateLastModificationTimeForTest() {
461 WebInspector.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE; 461 Sources.SourcesPanel._lastModificationTimeout = Number.MAX_VALUE;
462 } 462 }
463 463
464 _callFrameChanged() { 464 _callFrameChanged() {
465 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.CallF rame); 465 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
466 if (!callFrame) 466 if (!callFrame)
467 return; 467 return;
468 if (this._executionLineLocation) 468 if (this._executionLineLocation)
469 this._executionLineLocation.dispose(); 469 this._executionLineLocation.dispose();
470 this._executionLineLocation = WebInspector.debuggerWorkspaceBinding.createCa llFrameLiveLocation( 470 this._executionLineLocation = Bindings.debuggerWorkspaceBinding.createCallFr ameLiveLocation(
471 callFrame.location(), this._executionLineChanged.bind(this), this._liveL ocationPool); 471 callFrame.location(), this._executionLineChanged.bind(this), this._liveL ocationPool);
472 } 472 }
473 473
474 _pauseOnExceptionEnabledChanged() { 474 _pauseOnExceptionEnabledChanged() {
475 var enabled = WebInspector.moduleSetting('pauseOnExceptionEnabled').get(); 475 var enabled = Common.moduleSetting('pauseOnExceptionEnabled').get();
476 this._pauseOnExceptionButton.setToggled(enabled); 476 this._pauseOnExceptionButton.setToggled(enabled);
477 this._pauseOnExceptionButton.setTitle( 477 this._pauseOnExceptionButton.setTitle(
478 WebInspector.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on exceptions')); 478 Common.UIString(enabled ? 'Don\'t pause on exceptions' : 'Pause on excep tions'));
479 this._debugToolbarDrawer.classList.toggle('expanded', enabled); 479 this._debugToolbarDrawer.classList.toggle('expanded', enabled);
480 } 480 }
481 481
482 _updateDebuggerButtonsAndStatus() { 482 _updateDebuggerButtonsAndStatus() {
483 var currentTarget = WebInspector.context.flavor(WebInspector.Target); 483 var currentTarget = UI.context.flavor(SDK.Target);
484 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(currentTarg et); 484 var currentDebuggerModel = SDK.DebuggerModel.fromTarget(currentTarget);
485 if (!currentDebuggerModel) { 485 if (!currentDebuggerModel) {
486 this._togglePauseAction.setEnabled(false); 486 this._togglePauseAction.setEnabled(false);
487 this._stepOverAction.setEnabled(false); 487 this._stepOverAction.setEnabled(false);
488 this._stepIntoAction.setEnabled(false); 488 this._stepIntoAction.setEnabled(false);
489 this._stepOutAction.setEnabled(false); 489 this._stepOutAction.setEnabled(false);
490 } else if (this._paused) { 490 } else if (this._paused) {
491 this._togglePauseAction.setToggled(true); 491 this._togglePauseAction.setToggled(true);
492 this._togglePauseAction.setEnabled(true); 492 this._togglePauseAction.setEnabled(true);
493 this._stepOverAction.setEnabled(true); 493 this._stepOverAction.setEnabled(true);
494 this._stepIntoAction.setEnabled(true); 494 this._stepIntoAction.setEnabled(true);
495 this._stepOutAction.setEnabled(true); 495 this._stepOutAction.setEnabled(true);
496 } else { 496 } else {
497 this._togglePauseAction.setToggled(false); 497 this._togglePauseAction.setToggled(false);
498 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing()); 498 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing());
499 this._stepOverAction.setEnabled(false); 499 this._stepOverAction.setEnabled(false);
500 this._stepIntoAction.setEnabled(false); 500 this._stepIntoAction.setEnabled(false);
501 this._stepOutAction.setEnabled(false); 501 this._stepOutAction.setEnabled(false);
502 } 502 }
503 503
504 var details = currentDebuggerModel ? currentDebuggerModel.debuggerPausedDeta ils() : null; 504 var details = currentDebuggerModel ? currentDebuggerModel.debuggerPausedDeta ils() : null;
505 this._debuggerPausedMessage.render(details, WebInspector.debuggerWorkspaceBi nding, WebInspector.breakpointManager); 505 this._debuggerPausedMessage.render(details, Bindings.debuggerWorkspaceBindin g, Bindings.breakpointManager);
506 } 506 }
507 507
508 _clearInterface() { 508 _clearInterface() {
509 this._sourcesView.clearCurrentExecutionLine(); 509 this._sourcesView.clearCurrentExecutionLine();
510 this._updateDebuggerButtonsAndStatus(); 510 this._updateDebuggerButtonsAndStatus();
511 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null); 511 UI.context.setFlavor(SDK.DebuggerPausedDetails, null);
512 512
513 if (this._switchToPausedTargetTimeout) 513 if (this._switchToPausedTargetTimeout)
514 clearTimeout(this._switchToPausedTargetTimeout); 514 clearTimeout(this._switchToPausedTargetTimeout);
515 this._liveLocationPool.disposeAll(); 515 this._liveLocationPool.disposeAll();
516 } 516 }
517 517
518 /** 518 /**
519 * @param {!WebInspector.DebuggerModel} debuggerModel 519 * @param {!SDK.DebuggerModel} debuggerModel
520 */ 520 */
521 _switchToPausedTarget(debuggerModel) { 521 _switchToPausedTarget(debuggerModel) {
522 delete this._switchToPausedTargetTimeout; 522 delete this._switchToPausedTargetTimeout;
523 if (this._paused) 523 if (this._paused)
524 return; 524 return;
525 var target = WebInspector.context.flavor(WebInspector.Target); 525 var target = UI.context.flavor(SDK.Target);
526 if (debuggerModel.isPaused()) 526 if (debuggerModel.isPaused())
527 return; 527 return;
528 var debuggerModels = WebInspector.DebuggerModel.instances(); 528 var debuggerModels = SDK.DebuggerModel.instances();
529 for (var i = 0; i < debuggerModels.length; ++i) { 529 for (var i = 0; i < debuggerModels.length; ++i) {
530 if (debuggerModels[i].isPaused()) { 530 if (debuggerModels[i].isPaused()) {
531 WebInspector.context.setFlavor(WebInspector.Target, debuggerModels[i].ta rget()); 531 UI.context.setFlavor(SDK.Target, debuggerModels[i].target());
532 break; 532 break;
533 } 533 }
534 } 534 }
535 } 535 }
536 536
537 _togglePauseOnExceptions() { 537 _togglePauseOnExceptions() {
538 WebInspector.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExce ptionButton.toggled()); 538 Common.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionB utton.toggled());
539 } 539 }
540 540
541 /** 541 /**
542 * @return {boolean} 542 * @return {boolean}
543 */ 543 */
544 _runSnippet() { 544 _runSnippet() {
545 var uiSourceCode = this._sourcesView.currentUISourceCode(); 545 var uiSourceCode = this._sourcesView.currentUISourceCode();
546 if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets) 546 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets)
547 return false; 547 return false;
548 548
549 var currentExecutionContext = WebInspector.context.flavor(WebInspector.Execu tionContext); 549 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
550 if (!currentExecutionContext) 550 if (!currentExecutionContext)
551 return false; 551 return false;
552 552
553 WebInspector.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContex t, uiSourceCode); 553 Snippets.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext, u iSourceCode);
554 return true; 554 return true;
555 } 555 }
556 556
557 /** 557 /**
558 * @param {!WebInspector.Event} event 558 * @param {!Common.Event} event
559 */ 559 */
560 _editorSelected(event) { 560 _editorSelected(event) {
561 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 561 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
562 if (this.editorView.mainWidget() && WebInspector.moduleSetting('autoRevealIn Navigator').get()) 562 if (this.editorView.mainWidget() && Common.moduleSetting('autoRevealInNaviga tor').get())
563 this._revealInNavigator(uiSourceCode, true); 563 this._revealInNavigator(uiSourceCode, true);
564 } 564 }
565 565
566 /** 566 /**
567 * @return {boolean} 567 * @return {boolean}
568 */ 568 */
569 _togglePause() { 569 _togglePause() {
570 var target = WebInspector.context.flavor(WebInspector.Target); 570 var target = UI.context.flavor(SDK.Target);
571 if (!target) 571 if (!target)
572 return true; 572 return true;
573 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 573 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
574 if (!debuggerModel) 574 if (!debuggerModel)
575 return true; 575 return true;
576 576
577 if (this._paused) { 577 if (this._paused) {
578 this._paused = false; 578 this._paused = false;
579 debuggerModel.resume(); 579 debuggerModel.resume();
580 } else { 580 } else {
581 // Make sure pauses didn't stick skipped. 581 // Make sure pauses didn't stick skipped.
582 debuggerModel.pause(); 582 debuggerModel.pause();
583 } 583 }
584 584
585 this._clearInterface(); 585 this._clearInterface();
586 return true; 586 return true;
587 } 587 }
588 588
589 /** 589 /**
590 * @return {?WebInspector.DebuggerModel} 590 * @return {?SDK.DebuggerModel}
591 */ 591 */
592 _prepareToResume() { 592 _prepareToResume() {
593 if (!this._paused) 593 if (!this._paused)
594 return null; 594 return null;
595 595
596 this._paused = false; 596 this._paused = false;
597 597
598 this._clearInterface(); 598 this._clearInterface();
599 var target = WebInspector.context.flavor(WebInspector.Target); 599 var target = UI.context.flavor(SDK.Target);
600 return target ? WebInspector.DebuggerModel.fromTarget(target) : null; 600 return target ? SDK.DebuggerModel.fromTarget(target) : null;
601 } 601 }
602 602
603 /** 603 /**
604 * @return {boolean} 604 * @return {boolean}
605 */ 605 */
606 _longResume() { 606 _longResume() {
607 var debuggerModel = this._prepareToResume(); 607 var debuggerModel = this._prepareToResume();
608 if (!debuggerModel) 608 if (!debuggerModel)
609 return true; 609 return true;
610 610
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 _stepOut() { 643 _stepOut() {
644 var debuggerModel = this._prepareToResume(); 644 var debuggerModel = this._prepareToResume();
645 if (!debuggerModel) 645 if (!debuggerModel)
646 return true; 646 return true;
647 647
648 debuggerModel.stepOut(); 648 debuggerModel.stepOut();
649 return true; 649 return true;
650 } 650 }
651 651
652 /** 652 /**
653 * @param {!WebInspector.UILocation} uiLocation 653 * @param {!Workspace.UILocation} uiLocation
654 */ 654 */
655 _continueToLocation(uiLocation) { 655 _continueToLocation(uiLocation) {
656 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon text); 656 var executionContext = UI.context.flavor(SDK.ExecutionContext);
657 if (!executionContext) 657 if (!executionContext)
658 return; 658 return;
659 659
660 // Always use 0 column. 660 // Always use 0 column.
661 var rawLocation = WebInspector.debuggerWorkspaceBinding.uiLocationToRawLocat ion( 661 var rawLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(
662 executionContext.target(), uiLocation.uiSourceCode, uiLocation.lineNumbe r, 0); 662 executionContext.target(), uiLocation.uiSourceCode, uiLocation.lineNumbe r, 0);
663 if (!rawLocation) 663 if (!rawLocation)
664 return; 664 return;
665 665
666 if (!this._prepareToResume()) 666 if (!this._prepareToResume())
667 return; 667 return;
668 668
669 rawLocation.continueToLocation(); 669 rawLocation.continueToLocation();
670 } 670 }
671 671
672 _toggleBreakpointsActive() { 672 _toggleBreakpointsActive() {
673 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakpoint Manager.breakpointsActive()); 673 Bindings.breakpointManager.setBreakpointsActive(!Bindings.breakpointManager. breakpointsActive());
674 } 674 }
675 675
676 _breakpointsActiveStateChanged(event) { 676 _breakpointsActiveStateChanged(event) {
677 var active = event.data; 677 var active = event.data;
678 this._toggleBreakpointsActiveAction.setToggled(!active); 678 this._toggleBreakpointsActiveAction.setToggled(!active);
679 this._sourcesView.toggleBreakpointsActiveState(active); 679 this._sourcesView.toggleBreakpointsActiveState(active);
680 } 680 }
681 681
682 /** 682 /**
683 * @return {!WebInspector.Toolbar} 683 * @return {!UI.Toolbar}
684 */ 684 */
685 _createDebugToolbar() { 685 _createDebugToolbar() {
686 var debugToolbar = new WebInspector.Toolbar('scripts-debug-toolbar'); 686 var debugToolbar = new UI.Toolbar('scripts-debug-toolbar');
687 687
688 var longResumeButton = new WebInspector.ToolbarButton( 688 var longResumeButton = new UI.ToolbarButton(
689 WebInspector.UIString('Resume with all pauses blocked for 500 ms'), 'lar geicon-play'); 689 Common.UIString('Resume with all pauses blocked for 500 ms'), 'largeicon -play');
690 longResumeButton.addEventListener('click', this._longResume.bind(this), this ); 690 longResumeButton.addEventListener('click', this._longResume.bind(this), this );
691 debugToolbar.appendToolbarItem( 691 debugToolbar.appendToolbarItem(
692 WebInspector.Toolbar.createActionButton(this._togglePauseAction, [longRe sumeButton], [])); 692 UI.Toolbar.createActionButton(this._togglePauseAction, [longResumeButton ], []));
693 693
694 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOverAction)); 694 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOverA ction));
695 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepIntoAction)); 695 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepIntoA ction));
696 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOutAction)); 696 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._stepOutAc tion));
697 debugToolbar.appendSeparator(); 697 debugToolbar.appendSeparator();
698 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _toggleBreakpointsActiveAction)); 698 debugToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._toggleBre akpointsActiveAction));
699 699
700 this._pauseOnExceptionButton = new WebInspector.ToolbarToggle('', 'largeicon -pause-on-exceptions'); 700 this._pauseOnExceptionButton = new UI.ToolbarToggle('', 'largeicon-pause-on- exceptions');
701 this._pauseOnExceptionButton.addEventListener('click', this._togglePauseOnEx ceptions, this); 701 this._pauseOnExceptionButton.addEventListener('click', this._togglePauseOnEx ceptions, this);
702 debugToolbar.appendToolbarItem(this._pauseOnExceptionButton); 702 debugToolbar.appendToolbarItem(this._pauseOnExceptionButton);
703 703
704 debugToolbar.appendSeparator(); 704 debugToolbar.appendSeparator();
705 debugToolbar.appendToolbarItem(new WebInspector.ToolbarCheckbox( 705 debugToolbar.appendToolbarItem(new UI.ToolbarCheckbox(
706 WebInspector.UIString('Async'), WebInspector.UIString('Capture async sta ck traces'), 706 Common.UIString('Async'), Common.UIString('Capture async stack traces'),
707 WebInspector.moduleSetting('enableAsyncStackTraces'))); 707 Common.moduleSetting('enableAsyncStackTraces')));
708 708
709 return debugToolbar; 709 return debugToolbar;
710 } 710 }
711 711
712 _createDebugToolbarDrawer() { 712 _createDebugToolbarDrawer() {
713 var debugToolbarDrawer = createElementWithClass('div', 'scripts-debug-toolba r-drawer'); 713 var debugToolbarDrawer = createElementWithClass('div', 'scripts-debug-toolba r-drawer');
714 714
715 var label = WebInspector.UIString('Pause On Caught Exceptions'); 715 var label = Common.UIString('Pause On Caught Exceptions');
716 var setting = WebInspector.moduleSetting('pauseOnCaughtException'); 716 var setting = Common.moduleSetting('pauseOnCaughtException');
717 debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingCheckbox (label, setting, true)); 717 debugToolbarDrawer.appendChild(UI.SettingsUI.createSettingCheckbox(label, se tting, true));
718 718
719 return debugToolbarDrawer; 719 return debugToolbarDrawer;
720 } 720 }
721 721
722 /** 722 /**
723 * @param {!WebInspector.UISourceCode} uiSourceCode 723 * @param {!Workspace.UISourceCode} uiSourceCode
724 */ 724 */
725 _showLocalHistory(uiSourceCode) { 725 _showLocalHistory(uiSourceCode) {
726 WebInspector.RevisionHistoryView.showHistory(uiSourceCode); 726 Sources.RevisionHistoryView.showHistory(uiSourceCode);
727 } 727 }
728 728
729 /** 729 /**
730 * @override 730 * @override
731 * @param {!Event} event 731 * @param {!Event} event
732 * @param {!WebInspector.ContextMenu} contextMenu 732 * @param {!UI.ContextMenu} contextMenu
733 * @param {!Object} target 733 * @param {!Object} target
734 */ 734 */
735 appendApplicableItems(event, contextMenu, target) { 735 appendApplicableItems(event, contextMenu, target) {
736 this._appendUISourceCodeItems(event, contextMenu, target); 736 this._appendUISourceCodeItems(event, contextMenu, target);
737 this._appendUISourceCodeFrameItems(event, contextMenu, target); 737 this._appendUISourceCodeFrameItems(event, contextMenu, target);
738 this.appendUILocationItems(contextMenu, target); 738 this.appendUILocationItems(contextMenu, target);
739 this._appendRemoteObjectItems(contextMenu, target); 739 this._appendRemoteObjectItems(contextMenu, target);
740 this._appendNetworkRequestItems(contextMenu, target); 740 this._appendNetworkRequestItems(contextMenu, target);
741 } 741 }
742 742
743 /** 743 /**
744 * @param {!WebInspector.UISourceCode} uiSourceCode 744 * @param {!Workspace.UISourceCode} uiSourceCode
745 */ 745 */
746 mapFileSystemToNetwork(uiSourceCode) { 746 mapFileSystemToNetwork(uiSourceCode) {
747 WebInspector.SelectUISourceCodeForProjectTypesDialog.show( 747 Sources.SelectUISourceCodeForProjectTypesDialog.show(
748 uiSourceCode.name(), [WebInspector.projectTypes.Network, WebInspector.pr ojectTypes.ContentScripts], 748 uiSourceCode.name(), [Workspace.projectTypes.Network, Workspace.projectT ypes.ContentScripts],
749 mapFileSystemToNetwork.bind(this)); 749 mapFileSystemToNetwork.bind(this));
750 750
751 /** 751 /**
752 * @param {?WebInspector.UISourceCode} networkUISourceCode 752 * @param {?Workspace.UISourceCode} networkUISourceCode
753 * @this {WebInspector.SourcesPanel} 753 * @this {Sources.SourcesPanel}
754 */ 754 */
755 function mapFileSystemToNetwork(networkUISourceCode) { 755 function mapFileSystemToNetwork(networkUISourceCode) {
756 if (!networkUISourceCode) 756 if (!networkUISourceCode)
757 return; 757 return;
758 this._networkMapping.addMapping(networkUISourceCode, uiSourceCode); 758 this._networkMapping.addMapping(networkUISourceCode, uiSourceCode);
759 } 759 }
760 } 760 }
761 761
762 /** 762 /**
763 * @param {!WebInspector.UISourceCode} networkUISourceCode 763 * @param {!Workspace.UISourceCode} networkUISourceCode
764 */ 764 */
765 mapNetworkToFileSystem(networkUISourceCode) { 765 mapNetworkToFileSystem(networkUISourceCode) {
766 WebInspector.SelectUISourceCodeForProjectTypesDialog.show( 766 Sources.SelectUISourceCodeForProjectTypesDialog.show(
767 networkUISourceCode.name(), [WebInspector.projectTypes.FileSystem], mapN etworkToFileSystem.bind(this)); 767 networkUISourceCode.name(), [Workspace.projectTypes.FileSystem], mapNetw orkToFileSystem.bind(this));
768 768
769 /** 769 /**
770 * @param {?WebInspector.UISourceCode} uiSourceCode 770 * @param {?Workspace.UISourceCode} uiSourceCode
771 * @this {WebInspector.SourcesPanel} 771 * @this {Sources.SourcesPanel}
772 */ 772 */
773 function mapNetworkToFileSystem(uiSourceCode) { 773 function mapNetworkToFileSystem(uiSourceCode) {
774 if (!uiSourceCode) 774 if (!uiSourceCode)
775 return; 775 return;
776 this._networkMapping.addMapping(networkUISourceCode, uiSourceCode); 776 this._networkMapping.addMapping(networkUISourceCode, uiSourceCode);
777 } 777 }
778 } 778 }
779 779
780 /** 780 /**
781 * @param {!WebInspector.UISourceCode} uiSourceCode 781 * @param {!Workspace.UISourceCode} uiSourceCode
782 */ 782 */
783 _removeNetworkMapping(uiSourceCode) { 783 _removeNetworkMapping(uiSourceCode) {
784 this._networkMapping.removeMapping(uiSourceCode); 784 this._networkMapping.removeMapping(uiSourceCode);
785 } 785 }
786 786
787 /** 787 /**
788 * @param {!WebInspector.ContextMenu} contextMenu 788 * @param {!UI.ContextMenu} contextMenu
789 * @param {!WebInspector.UISourceCode} uiSourceCode 789 * @param {!Workspace.UISourceCode} uiSourceCode
790 */ 790 */
791 _appendUISourceCodeMappingItems(contextMenu, uiSourceCode) { 791 _appendUISourceCodeMappingItems(contextMenu, uiSourceCode) {
792 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); 792 Sources.NavigatorView.appendAddFolderItem(contextMenu);
793 793
794 if (Runtime.experiments.isEnabled('persistence2')) 794 if (Runtime.experiments.isEnabled('persistence2'))
795 return; 795 return;
796 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) { 796 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) {
797 var binding = WebInspector.persistence.binding(uiSourceCode); 797 var binding = Persistence.persistence.binding(uiSourceCode);
798 if (!binding) 798 if (!binding)
799 contextMenu.appendItem( 799 contextMenu.appendItem(
800 WebInspector.UIString.capitalize('Map to ^network ^resource\u2026'), 800 Common.UIString.capitalize('Map to ^network ^resource\u2026'),
801 this.mapFileSystemToNetwork.bind(this, uiSourceCode)); 801 this.mapFileSystemToNetwork.bind(this, uiSourceCode));
802 else 802 else
803 contextMenu.appendItem( 803 contextMenu.appendItem(
804 WebInspector.UIString.capitalize('Remove ^network ^mapping'), 804 Common.UIString.capitalize('Remove ^network ^mapping'),
805 this._removeNetworkMapping.bind(this, binding.network)); 805 this._removeNetworkMapping.bind(this, binding.network));
806 } 806 }
807 807
808 /** 808 /**
809 * @param {!WebInspector.Project} project 809 * @param {!Workspace.Project} project
810 */ 810 */
811 function filterProject(project) { 811 function filterProject(project) {
812 return project.type() === WebInspector.projectTypes.FileSystem; 812 return project.type() === Workspace.projectTypes.FileSystem;
813 } 813 }
814 814
815 if (uiSourceCode.project().type() === WebInspector.projectTypes.Network || 815 if (uiSourceCode.project().type() === Workspace.projectTypes.Network ||
816 uiSourceCode.project().type() === WebInspector.projectTypes.ContentScrip ts) { 816 uiSourceCode.project().type() === Workspace.projectTypes.ContentScripts) {
817 if (!this._workspace.projects().filter(filterProject).length) 817 if (!this._workspace.projects().filter(filterProject).length)
818 return; 818 return;
819 if (this._networkMapping.uiSourceCodeForURLForAnyTarget(uiSourceCode.url() ) === uiSourceCode) 819 if (this._networkMapping.uiSourceCodeForURLForAnyTarget(uiSourceCode.url() ) === uiSourceCode)
820 contextMenu.appendItem( 820 contextMenu.appendItem(
821 WebInspector.UIString.capitalize('Map to ^file ^system ^resource\u20 26'), 821 Common.UIString.capitalize('Map to ^file ^system ^resource\u2026'),
822 this.mapNetworkToFileSystem.bind(this, uiSourceCode)); 822 this.mapNetworkToFileSystem.bind(this, uiSourceCode));
823 } 823 }
824 } 824 }
825 825
826 /** 826 /**
827 * @param {!Event} event 827 * @param {!Event} event
828 * @param {!WebInspector.ContextMenu} contextMenu 828 * @param {!UI.ContextMenu} contextMenu
829 * @param {!Object} target 829 * @param {!Object} target
830 */ 830 */
831 _appendUISourceCodeItems(event, contextMenu, target) { 831 _appendUISourceCodeItems(event, contextMenu, target) {
832 if (!(target instanceof WebInspector.UISourceCode)) 832 if (!(target instanceof Workspace.UISourceCode))
833 return; 833 return;
834 834
835 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (target); 835 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target);
836 var projectType = uiSourceCode.project().type(); 836 var projectType = uiSourceCode.project().type();
837 837
838 if (projectType !== WebInspector.projectTypes.Debugger && 838 if (projectType !== Workspace.projectTypes.Debugger &&
839 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget(). element)) { 839 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget(). element)) {
840 contextMenu.appendItem( 840 contextMenu.appendItem(
841 WebInspector.UIString.capitalize('Reveal in ^navigator'), 841 Common.UIString.capitalize('Reveal in ^navigator'),
842 this._handleContextMenuReveal.bind(this, uiSourceCode)); 842 this._handleContextMenuReveal.bind(this, uiSourceCode));
843 contextMenu.appendSeparator(); 843 contextMenu.appendSeparator();
844 } 844 }
845 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); 845 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
846 if (projectType !== WebInspector.projectTypes.FileSystem) 846 if (projectType !== Workspace.projectTypes.FileSystem)
847 contextMenu.appendItem( 847 contextMenu.appendItem(
848 WebInspector.UIString.capitalize('Local ^modifications\u2026'), 848 Common.UIString.capitalize('Local ^modifications\u2026'),
849 this._showLocalHistory.bind(this, uiSourceCode)); 849 this._showLocalHistory.bind(this, uiSourceCode));
850 } 850 }
851 851
852 /** 852 /**
853 * @param {!Event} event 853 * @param {!Event} event
854 * @param {!WebInspector.ContextMenu} contextMenu 854 * @param {!UI.ContextMenu} contextMenu
855 * @param {!Object} target 855 * @param {!Object} target
856 */ 856 */
857 _appendUISourceCodeFrameItems(event, contextMenu, target) { 857 _appendUISourceCodeFrameItems(event, contextMenu, target) {
858 if (!(target instanceof WebInspector.UISourceCodeFrame)) 858 if (!(target instanceof Sources.UISourceCodeFrame))
859 return; 859 return;
860 contextMenu.appendAction('debugger.evaluate-selection'); 860 contextMenu.appendAction('debugger.evaluate-selection');
861 } 861 }
862 862
863 /** 863 /**
864 * @param {!WebInspector.ContextMenu} contextMenu 864 * @param {!UI.ContextMenu} contextMenu
865 * @param {!Object} object 865 * @param {!Object} object
866 */ 866 */
867 appendUILocationItems(contextMenu, object) { 867 appendUILocationItems(contextMenu, object) {
868 if (!(object instanceof WebInspector.UILocation)) 868 if (!(object instanceof Workspace.UILocation))
869 return; 869 return;
870 var uiLocation = /** @type {!WebInspector.UILocation} */ (object); 870 var uiLocation = /** @type {!Workspace.UILocation} */ (object);
871 var uiSourceCode = uiLocation.uiSourceCode; 871 var uiSourceCode = uiLocation.uiSourceCode;
872 var projectType = uiSourceCode.project().type(); 872 var projectType = uiSourceCode.project().type();
873 873
874 var contentType = uiSourceCode.contentType(); 874 var contentType = uiSourceCode.contentType();
875 if (contentType.hasScripts()) { 875 if (contentType.hasScripts()) {
876 var target = WebInspector.context.flavor(WebInspector.Target); 876 var target = UI.context.flavor(SDK.Target);
877 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 877 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
878 if (debuggerModel && debuggerModel.isPaused()) 878 if (debuggerModel && debuggerModel.isPaused())
879 contextMenu.appendItem( 879 contextMenu.appendItem(
880 WebInspector.UIString.capitalize('Continue to ^here'), this._continu eToLocation.bind(this, uiLocation)); 880 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc ation.bind(this, uiLocation));
881 } 881 }
882 882
883 if (contentType.hasScripts() && projectType !== WebInspector.projectTypes.Sn ippets) 883 if (contentType.hasScripts() && projectType !== Workspace.projectTypes.Snipp ets)
884 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc eCode); 884 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc eCode);
885 } 885 }
886 886
887 /** 887 /**
888 * @param {!WebInspector.UISourceCode} uiSourceCode 888 * @param {!Workspace.UISourceCode} uiSourceCode
889 */ 889 */
890 _handleContextMenuReveal(uiSourceCode) { 890 _handleContextMenuReveal(uiSourceCode) {
891 this.editorView.showBoth(); 891 this.editorView.showBoth();
892 this._revealInNavigator(uiSourceCode); 892 this._revealInNavigator(uiSourceCode);
893 } 893 }
894 894
895 /** 895 /**
896 * @param {!WebInspector.ContextMenu} contextMenu 896 * @param {!UI.ContextMenu} contextMenu
897 * @param {!Object} target 897 * @param {!Object} target
898 */ 898 */
899 _appendRemoteObjectItems(contextMenu, target) { 899 _appendRemoteObjectItems(contextMenu, target) {
900 if (!(target instanceof WebInspector.RemoteObject)) 900 if (!(target instanceof SDK.RemoteObject))
901 return; 901 return;
902 var remoteObject = /** @type {!WebInspector.RemoteObject} */ (target); 902 var remoteObject = /** @type {!SDK.RemoteObject} */ (target);
903 contextMenu.appendItem( 903 contextMenu.appendItem(
904 WebInspector.UIString.capitalize('Store as ^global ^variable'), 904 Common.UIString.capitalize('Store as ^global ^variable'),
905 this._saveToTempVariable.bind(this, remoteObject)); 905 this._saveToTempVariable.bind(this, remoteObject));
906 if (remoteObject.type === 'function') 906 if (remoteObject.type === 'function')
907 contextMenu.appendItem( 907 contextMenu.appendItem(
908 WebInspector.UIString.capitalize('Show ^function ^definition'), 908 Common.UIString.capitalize('Show ^function ^definition'),
909 this._showFunctionDefinition.bind(this, remoteObject)); 909 this._showFunctionDefinition.bind(this, remoteObject));
910 } 910 }
911 911
912 /** 912 /**
913 * @param {!WebInspector.ContextMenu} contextMenu 913 * @param {!UI.ContextMenu} contextMenu
914 * @param {!Object} target 914 * @param {!Object} target
915 */ 915 */
916 _appendNetworkRequestItems(contextMenu, target) { 916 _appendNetworkRequestItems(contextMenu, target) {
917 if (!(target instanceof WebInspector.NetworkRequest)) 917 if (!(target instanceof SDK.NetworkRequest))
918 return; 918 return;
919 var request = /** @type {!WebInspector.NetworkRequest} */ (target); 919 var request = /** @type {!SDK.NetworkRequest} */ (target);
920 var uiSourceCode = this._networkMapping.uiSourceCodeForURLForAnyTarget(reque st.url); 920 var uiSourceCode = this._networkMapping.uiSourceCodeForURLForAnyTarget(reque st.url);
921 if (!uiSourceCode) 921 if (!uiSourceCode)
922 return; 922 return;
923 var openText = WebInspector.UIString.capitalize('Open in Sources ^panel'); 923 var openText = Common.UIString.capitalize('Open in Sources ^panel');
924 contextMenu.appendItem(openText, this.showUILocation.bind(this, uiSourceCode .uiLocation(0, 0))); 924 contextMenu.appendItem(openText, this.showUILocation.bind(this, uiSourceCode .uiLocation(0, 0)));
925 } 925 }
926 926
927 /** 927 /**
928 * @param {!WebInspector.RemoteObject} remoteObject 928 * @param {!SDK.RemoteObject} remoteObject
929 */ 929 */
930 _saveToTempVariable(remoteObject) { 930 _saveToTempVariable(remoteObject) {
931 var currentExecutionContext = WebInspector.context.flavor(WebInspector.Execu tionContext); 931 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
932 if (!currentExecutionContext) 932 if (!currentExecutionContext)
933 return; 933 return;
934 934
935 currentExecutionContext.globalObject('', false, didGetGlobalObject); 935 currentExecutionContext.globalObject('', false, didGetGlobalObject);
936 /** 936 /**
937 * @param {?WebInspector.RemoteObject} global 937 * @param {?SDK.RemoteObject} global
938 * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails 938 * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails
939 */ 939 */
940 function didGetGlobalObject(global, exceptionDetails) { 940 function didGetGlobalObject(global, exceptionDetails) {
941 /** 941 /**
942 * @suppressReceiverCheck 942 * @suppressReceiverCheck
943 * @this {Window} 943 * @this {Window}
944 */ 944 */
945 function remoteFunction(value) { 945 function remoteFunction(value) {
946 var prefix = 'temp'; 946 var prefix = 'temp';
947 var index = 1; 947 var index = 1;
948 while ((prefix + index) in this) 948 while ((prefix + index) in this)
949 ++index; 949 ++index;
950 var name = prefix + index; 950 var name = prefix + index;
951 this[name] = value; 951 this[name] = value;
952 return name; 952 return name;
953 } 953 }
954 954
955 if (!!exceptionDetails || !global) 955 if (!!exceptionDetails || !global)
956 failedToSave(global); 956 failedToSave(global);
957 else 957 else
958 global.callFunction( 958 global.callFunction(
959 remoteFunction, [WebInspector.RemoteObject.toCallArgument(remoteObje ct)], didSave.bind(null, global)); 959 remoteFunction, [SDK.RemoteObject.toCallArgument(remoteObject)], did Save.bind(null, global));
960 } 960 }
961 961
962 /** 962 /**
963 * @param {!WebInspector.RemoteObject} global 963 * @param {!SDK.RemoteObject} global
964 * @param {?WebInspector.RemoteObject} result 964 * @param {?SDK.RemoteObject} result
965 * @param {boolean=} wasThrown 965 * @param {boolean=} wasThrown
966 */ 966 */
967 function didSave(global, result, wasThrown) { 967 function didSave(global, result, wasThrown) {
968 global.release(); 968 global.release();
969 if (wasThrown || !result || result.type !== 'string') 969 if (wasThrown || !result || result.type !== 'string')
970 failedToSave(result); 970 failedToSave(result);
971 else 971 else
972 WebInspector.ConsoleModel.evaluateCommandInConsole( 972 SDK.ConsoleModel.evaluateCommandInConsole(
973 /** @type {!WebInspector.ExecutionContext} */ (currentExecutionConte xt), result.value); 973 /** @type {!SDK.ExecutionContext} */ (currentExecutionContext), resu lt.value);
974 } 974 }
975 975
976 /** 976 /**
977 * @param {?WebInspector.RemoteObject} result 977 * @param {?SDK.RemoteObject} result
978 */ 978 */
979 function failedToSave(result) { 979 function failedToSave(result) {
980 var message = WebInspector.UIString('Failed to save to temp variable.'); 980 var message = Common.UIString('Failed to save to temp variable.');
981 if (result) { 981 if (result) {
982 message += ' ' + result.description; 982 message += ' ' + result.description;
983 result.release(); 983 result.release();
984 } 984 }
985 WebInspector.console.error(message); 985 Common.console.error(message);
986 } 986 }
987 } 987 }
988 988
989 /** 989 /**
990 * @param {!WebInspector.RemoteObject} remoteObject 990 * @param {!SDK.RemoteObject} remoteObject
991 */ 991 */
992 _showFunctionDefinition(remoteObject) { 992 _showFunctionDefinition(remoteObject) {
993 remoteObject.debuggerModel().functionDetailsPromise(remoteObject).then(this. _didGetFunctionDetails.bind(this)); 993 remoteObject.debuggerModel().functionDetailsPromise(remoteObject).then(this. _didGetFunctionDetails.bind(this));
994 } 994 }
995 995
996 /** 996 /**
997 * @param {?{location: ?WebInspector.DebuggerModel.Location}} response 997 * @param {?{location: ?SDK.DebuggerModel.Location}} response
998 */ 998 */
999 _didGetFunctionDetails(response) { 999 _didGetFunctionDetails(response) {
1000 if (!response || !response.location) 1000 if (!response || !response.location)
1001 return; 1001 return;
1002 1002
1003 var location = response.location; 1003 var location = response.location;
1004 if (!location) 1004 if (!location)
1005 return; 1005 return;
1006 1006
1007 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILocati on(location); 1007 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(l ocation);
1008 if (uiLocation) 1008 if (uiLocation)
1009 this.showUILocation(uiLocation); 1009 this.showUILocation(uiLocation);
1010 } 1010 }
1011 1011
1012 showGoToSourceDialog() { 1012 showGoToSourceDialog() {
1013 this._sourcesView.showOpenResourceDialog(); 1013 this._sourcesView.showOpenResourceDialog();
1014 } 1014 }
1015 1015
1016 _revealNavigatorSidebar() { 1016 _revealNavigatorSidebar() {
1017 this._setAsCurrentPanel(); 1017 this._setAsCurrentPanel();
1018 this.editorView.showBoth(true); 1018 this.editorView.showBoth(true);
1019 } 1019 }
1020 1020
1021 _revealDebuggerSidebar() { 1021 _revealDebuggerSidebar() {
1022 this._setAsCurrentPanel(); 1022 this._setAsCurrentPanel();
1023 this._splitWidget.showBoth(true); 1023 this._splitWidget.showBoth(true);
1024 } 1024 }
1025 1025
1026 _updateSidebarPosition() { 1026 _updateSidebarPosition() {
1027 var vertically; 1027 var vertically;
1028 var position = WebInspector.moduleSetting('sidebarPosition').get(); 1028 var position = Common.moduleSetting('sidebarPosition').get();
1029 if (position === 'right') 1029 if (position === 'right')
1030 vertically = false; 1030 vertically = false;
1031 else if (position === 'bottom') 1031 else if (position === 'bottom')
1032 vertically = true; 1032 vertically = true;
1033 else 1033 else
1034 vertically = WebInspector.inspectorView.element.offsetWidth < 680; 1034 vertically = UI.inspectorView.element.offsetWidth < 680;
1035 1035
1036 if (this.sidebarPaneView && vertically === !this._splitWidget.isVertical()) 1036 if (this.sidebarPaneView && vertically === !this._splitWidget.isVertical())
1037 return; 1037 return;
1038 1038
1039 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach()) 1039 if (this.sidebarPaneView && this.sidebarPaneView.shouldHideOnDetach())
1040 return; // We can't reparent extension iframes. 1040 return; // We can't reparent extension iframes.
1041 1041
1042 if (this.sidebarPaneView) 1042 if (this.sidebarPaneView)
1043 this.sidebarPaneView.detach(); 1043 this.sidebarPaneView.detach();
1044 1044
1045 this._splitWidget.setVertical(!vertically); 1045 this._splitWidget.setVertical(!vertically);
1046 this._splitWidget.element.classList.toggle('sources-split-view-vertical', ve rtically); 1046 this._splitWidget.element.classList.toggle('sources-split-view-vertical', ve rtically);
1047 1047
1048 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(this); 1048 Sources.SourcesPanel.updateResizerAndSidebarButtons(this);
1049 1049
1050 // Create vertical box with stack. 1050 // Create vertical box with stack.
1051 var vbox = new WebInspector.VBox(); 1051 var vbox = new UI.VBox();
1052 vbox.element.appendChild(this._debugToolbarDrawer); 1052 vbox.element.appendChild(this._debugToolbarDrawer);
1053 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minToolba rWidth, 100); 1053 vbox.setMinimumAndPreferredSizes(25, 25, Sources.SourcesPanel.minToolbarWidt h, 100);
1054 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(this._ revealDebuggerSidebar.bind(this)); 1054 this._sidebarPaneStack = UI.viewManager.createStackLocation(this._revealDebu ggerSidebar.bind(this));
1055 this._sidebarPaneStack.widget().element.classList.add('overflow-auto'); 1055 this._sidebarPaneStack.widget().element.classList.add('overflow-auto');
1056 this._sidebarPaneStack.widget().show(vbox.element); 1056 this._sidebarPaneStack.widget().show(vbox.element);
1057 this._sidebarPaneStack.widget().element.appendChild(this._debuggerPausedMess age.element()); 1057 this._sidebarPaneStack.widget().element.appendChild(this._debuggerPausedMess age.element());
1058 vbox.element.appendChild(this._debugToolbar.element); 1058 vbox.element.appendChild(this._debugToolbar.element);
1059 1059
1060 if (this._threadsSidebarPane) 1060 if (this._threadsSidebarPane)
1061 this._sidebarPaneStack.showView(this._threadsSidebarPane); 1061 this._sidebarPaneStack.showView(this._threadsSidebarPane);
1062 1062
1063 if (!vertically) 1063 if (!vertically)
1064 this._sidebarPaneStack.appendView(this._watchSidebarPane); 1064 this._sidebarPaneStack.appendView(this._watchSidebarPane);
1065 1065
1066 this._sidebarPaneStack.showView(this._callstackPane); 1066 this._sidebarPaneStack.showView(this._callstackPane);
1067 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.viewMana ger.view('sources.jsBreakpoints')); 1067 var jsBreakpoints = /** @type {!UI.View} */ (UI.viewManager.view('sources.js Breakpoints'));
1068 var scopeChainView = /** @type {!WebInspector.View} */ (WebInspector.viewMan ager.view('sources.scopeChain')); 1068 var scopeChainView = /** @type {!UI.View} */ (UI.viewManager.view('sources.s copeChain'));
1069 1069
1070 if (!vertically) { 1070 if (!vertically) {
1071 // Populate the rest of the stack. 1071 // Populate the rest of the stack.
1072 this._sidebarPaneStack.showView(scopeChainView); 1072 this._sidebarPaneStack.showView(scopeChainView);
1073 this._sidebarPaneStack.showView(jsBreakpoints); 1073 this._sidebarPaneStack.showView(jsBreakpoints);
1074 this._extensionSidebarPanesContainer = this._sidebarPaneStack; 1074 this._extensionSidebarPanesContainer = this._sidebarPaneStack;
1075 this.sidebarPaneView = vbox; 1075 this.sidebarPaneView = vbox;
1076 } else { 1076 } else {
1077 var splitWidget = new WebInspector.SplitWidget(true, true, 'sourcesPanelDe buggerSidebarSplitViewState', 0.5); 1077 var splitWidget = new UI.SplitWidget(true, true, 'sourcesPanelDebuggerSide barSplitViewState', 0.5);
1078 splitWidget.setMainWidget(vbox); 1078 splitWidget.setMainWidget(vbox);
1079 1079
1080 // Populate the left stack. 1080 // Populate the left stack.
1081 this._sidebarPaneStack.showView(jsBreakpoints); 1081 this._sidebarPaneStack.showView(jsBreakpoints);
1082 1082
1083 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(this._r evealDebuggerSidebar.bind(this)); 1083 var tabbedLocation = UI.viewManager.createTabbedLocation(this._revealDebug gerSidebar.bind(this));
1084 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane()); 1084 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane());
1085 tabbedLocation.appendView(scopeChainView); 1085 tabbedLocation.appendView(scopeChainView);
1086 tabbedLocation.appendView(this._watchSidebarPane); 1086 tabbedLocation.appendView(this._watchSidebarPane);
1087 this._extensionSidebarPanesContainer = tabbedLocation; 1087 this._extensionSidebarPanesContainer = tabbedLocation;
1088 this.sidebarPaneView = splitWidget; 1088 this.sidebarPaneView = splitWidget;
1089 } 1089 }
1090 1090
1091 this._sidebarPaneStack.appendApplicableItems('sources-sidebar'); 1091 this._sidebarPaneStack.appendApplicableItems('sources-sidebar');
1092 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); 1092 var extensionSidebarPanes = Extensions.extensionServer.sidebarPanes();
1093 for (var i = 0; i < extensionSidebarPanes.length; ++i) 1093 for (var i = 0; i < extensionSidebarPanes.length; ++i)
1094 this._addExtensionSidebarPane(extensionSidebarPanes[i]); 1094 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
1095 1095
1096 this._splitWidget.setSidebarWidget(this.sidebarPaneView); 1096 this._splitWidget.setSidebarWidget(this.sidebarPaneView);
1097 } 1097 }
1098 1098
1099 /** 1099 /**
1100 * @return {!Promise} 1100 * @return {!Promise}
1101 */ 1101 */
1102 _setAsCurrentPanel() { 1102 _setAsCurrentPanel() {
1103 return WebInspector.viewManager.showView('sources'); 1103 return UI.viewManager.showView('sources');
1104 } 1104 }
1105 1105
1106 /** 1106 /**
1107 * @param {!WebInspector.Event} event 1107 * @param {!Common.Event} event
1108 */ 1108 */
1109 _extensionSidebarPaneAdded(event) { 1109 _extensionSidebarPaneAdded(event) {
1110 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data); 1110 var pane = /** @type {!Extensions.ExtensionSidebarPane} */ (event.data);
1111 this._addExtensionSidebarPane(pane); 1111 this._addExtensionSidebarPane(pane);
1112 } 1112 }
1113 1113
1114 /** 1114 /**
1115 * @param {!WebInspector.ExtensionSidebarPane} pane 1115 * @param {!Extensions.ExtensionSidebarPane} pane
1116 */ 1116 */
1117 _addExtensionSidebarPane(pane) { 1117 _addExtensionSidebarPane(pane) {
1118 if (pane.panelName() === this.name) 1118 if (pane.panelName() === this.name)
1119 this._extensionSidebarPanesContainer.appendView(pane); 1119 this._extensionSidebarPanesContainer.appendView(pane);
1120 } 1120 }
1121 1121
1122 /** 1122 /**
1123 * @return {!WebInspector.SourcesView} 1123 * @return {!Sources.SourcesView}
1124 */ 1124 */
1125 sourcesView() { 1125 sourcesView() {
1126 return this._sourcesView; 1126 return this._sourcesView;
1127 } 1127 }
1128 1128
1129 /** 1129 /**
1130 * @param {!DataTransfer} dataTransfer 1130 * @param {!DataTransfer} dataTransfer
1131 */ 1131 */
1132 _handleDrop(dataTransfer) { 1132 _handleDrop(dataTransfer) {
1133 var items = dataTransfer.items; 1133 var items = dataTransfer.items;
1134 if (!items.length) 1134 if (!items.length)
1135 return; 1135 return;
1136 var entry = items[0].webkitGetAsEntry(); 1136 var entry = items[0].webkitGetAsEntry();
1137 if (!entry.isDirectory) 1137 if (!entry.isDirectory)
1138 return; 1138 return;
1139 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesystem); 1139 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesystem);
1140 } 1140 }
1141 }; 1141 };
1142 1142
1143 WebInspector.SourcesPanel._lastModificationTimeout = 200; 1143 Sources.SourcesPanel._lastModificationTimeout = 200;
1144 1144
1145 WebInspector.SourcesPanel.minToolbarWidth = 215; 1145 Sources.SourcesPanel.minToolbarWidth = 215;
1146 1146
1147 /** 1147 /**
1148 * @implements {WebInspector.Revealer} 1148 * @implements {Common.Revealer}
1149 * @unrestricted 1149 * @unrestricted
1150 */ 1150 */
1151 WebInspector.SourcesPanel.UILocationRevealer = class { 1151 Sources.SourcesPanel.UILocationRevealer = class {
1152 /** 1152 /**
1153 * @override 1153 * @override
1154 * @param {!Object} uiLocation 1154 * @param {!Object} uiLocation
1155 * @param {boolean=} omitFocus 1155 * @param {boolean=} omitFocus
1156 * @return {!Promise} 1156 * @return {!Promise}
1157 */ 1157 */
1158 reveal(uiLocation, omitFocus) { 1158 reveal(uiLocation, omitFocus) {
1159 if (!(uiLocation instanceof WebInspector.UILocation)) 1159 if (!(uiLocation instanceof Workspace.UILocation))
1160 return Promise.reject(new Error('Internal error: not a ui location')); 1160 return Promise.reject(new Error('Internal error: not a ui location'));
1161 WebInspector.SourcesPanel.instance().showUILocation(uiLocation, omitFocus); 1161 Sources.SourcesPanel.instance().showUILocation(uiLocation, omitFocus);
1162 return Promise.resolve(); 1162 return Promise.resolve();
1163 } 1163 }
1164 }; 1164 };
1165 1165
1166 /** 1166 /**
1167 * @implements {WebInspector.Revealer} 1167 * @implements {Common.Revealer}
1168 * @unrestricted 1168 * @unrestricted
1169 */ 1169 */
1170 WebInspector.SourcesPanel.DebuggerLocationRevealer = class { 1170 Sources.SourcesPanel.DebuggerLocationRevealer = class {
1171 /** 1171 /**
1172 * @override 1172 * @override
1173 * @param {!Object} rawLocation 1173 * @param {!Object} rawLocation
1174 * @param {boolean=} omitFocus 1174 * @param {boolean=} omitFocus
1175 * @return {!Promise} 1175 * @return {!Promise}
1176 */ 1176 */
1177 reveal(rawLocation, omitFocus) { 1177 reveal(rawLocation, omitFocus) {
1178 if (!(rawLocation instanceof WebInspector.DebuggerModel.Location)) 1178 if (!(rawLocation instanceof SDK.DebuggerModel.Location))
1179 return Promise.reject(new Error('Internal error: not a debugger location') ); 1179 return Promise.reject(new Error('Internal error: not a debugger location') );
1180 WebInspector.SourcesPanel.instance().showUILocation( 1180 Sources.SourcesPanel.instance().showUILocation(
1181 WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(rawLocatio n), omitFocus); 1181 Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(rawLocation), omitFocus);
1182 return Promise.resolve(); 1182 return Promise.resolve();
1183 } 1183 }
1184 }; 1184 };
1185 1185
1186 /** 1186 /**
1187 * @implements {WebInspector.Revealer} 1187 * @implements {Common.Revealer}
1188 * @unrestricted 1188 * @unrestricted
1189 */ 1189 */
1190 WebInspector.SourcesPanel.UISourceCodeRevealer = class { 1190 Sources.SourcesPanel.UISourceCodeRevealer = class {
1191 /** 1191 /**
1192 * @override 1192 * @override
1193 * @param {!Object} uiSourceCode 1193 * @param {!Object} uiSourceCode
1194 * @param {boolean=} omitFocus 1194 * @param {boolean=} omitFocus
1195 * @return {!Promise} 1195 * @return {!Promise}
1196 */ 1196 */
1197 reveal(uiSourceCode, omitFocus) { 1197 reveal(uiSourceCode, omitFocus) {
1198 if (!(uiSourceCode instanceof WebInspector.UISourceCode)) 1198 if (!(uiSourceCode instanceof Workspace.UISourceCode))
1199 return Promise.reject(new Error('Internal error: not a ui source code')); 1199 return Promise.reject(new Error('Internal error: not a ui source code'));
1200 WebInspector.SourcesPanel.instance().showUISourceCode(uiSourceCode, undefine d, undefined, omitFocus); 1200 Sources.SourcesPanel.instance().showUISourceCode(uiSourceCode, undefined, un defined, omitFocus);
1201 return Promise.resolve(); 1201 return Promise.resolve();
1202 } 1202 }
1203 }; 1203 };
1204 1204
1205 /** 1205 /**
1206 * @implements {WebInspector.Revealer} 1206 * @implements {Common.Revealer}
1207 * @unrestricted 1207 * @unrestricted
1208 */ 1208 */
1209 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer = class { 1209 Sources.SourcesPanel.DebuggerPausedDetailsRevealer = class {
1210 /** 1210 /**
1211 * @override 1211 * @override
1212 * @param {!Object} object 1212 * @param {!Object} object
1213 * @return {!Promise} 1213 * @return {!Promise}
1214 */ 1214 */
1215 reveal(object) { 1215 reveal(object) {
1216 return WebInspector.SourcesPanel.instance()._setAsCurrentPanel(); 1216 return Sources.SourcesPanel.instance()._setAsCurrentPanel();
1217 } 1217 }
1218 }; 1218 };
1219 1219
1220 /** 1220 /**
1221 * @implements {WebInspector.ActionDelegate} 1221 * @implements {UI.ActionDelegate}
1222 * @unrestricted 1222 * @unrestricted
1223 */ 1223 */
1224 WebInspector.SourcesPanel.RevealingActionDelegate = class { 1224 Sources.SourcesPanel.RevealingActionDelegate = class {
1225 /** 1225 /**
1226 * @override 1226 * @override
1227 * @param {!WebInspector.Context} context 1227 * @param {!UI.Context} context
1228 * @param {string} actionId 1228 * @param {string} actionId
1229 * @return {boolean} 1229 * @return {boolean}
1230 */ 1230 */
1231 handleAction(context, actionId) { 1231 handleAction(context, actionId) {
1232 var panel = WebInspector.SourcesPanel.instance(); 1232 var panel = Sources.SourcesPanel.instance();
1233 if (!panel._ensureSourcesViewVisible()) 1233 if (!panel._ensureSourcesViewVisible())
1234 return false; 1234 return false;
1235 switch (actionId) { 1235 switch (actionId) {
1236 case 'debugger.toggle-pause': 1236 case 'debugger.toggle-pause':
1237 panel._togglePause(); 1237 panel._togglePause();
1238 return true; 1238 return true;
1239 case 'sources.go-to-source': 1239 case 'sources.go-to-source':
1240 panel.showGoToSourceDialog(); 1240 panel.showGoToSourceDialog();
1241 return true; 1241 return true;
1242 } 1242 }
1243 return false; 1243 return false;
1244 } 1244 }
1245 }; 1245 };
1246 1246
1247 /** 1247 /**
1248 * @implements {WebInspector.ActionDelegate} 1248 * @implements {UI.ActionDelegate}
1249 * @unrestricted 1249 * @unrestricted
1250 */ 1250 */
1251 WebInspector.SourcesPanel.DebuggingActionDelegate = class { 1251 Sources.SourcesPanel.DebuggingActionDelegate = class {
1252 /** 1252 /**
1253 * @override 1253 * @override
1254 * @param {!WebInspector.Context} context 1254 * @param {!UI.Context} context
1255 * @param {string} actionId 1255 * @param {string} actionId
1256 * @return {boolean} 1256 * @return {boolean}
1257 */ 1257 */
1258 handleAction(context, actionId) { 1258 handleAction(context, actionId) {
1259 var panel = WebInspector.SourcesPanel.instance(); 1259 var panel = Sources.SourcesPanel.instance();
1260 switch (actionId) { 1260 switch (actionId) {
1261 case 'debugger.step-over': 1261 case 'debugger.step-over':
1262 panel._stepOver(); 1262 panel._stepOver();
1263 return true; 1263 return true;
1264 case 'debugger.step-into': 1264 case 'debugger.step-into':
1265 panel._stepInto(); 1265 panel._stepInto();
1266 return true; 1266 return true;
1267 case 'debugger.step-out': 1267 case 'debugger.step-out':
1268 panel._stepOut(); 1268 panel._stepOut();
1269 return true; 1269 return true;
1270 case 'debugger.run-snippet': 1270 case 'debugger.run-snippet':
1271 panel._runSnippet(); 1271 panel._runSnippet();
1272 return true; 1272 return true;
1273 case 'debugger.toggle-breakpoints-active': 1273 case 'debugger.toggle-breakpoints-active':
1274 panel._toggleBreakpointsActive(); 1274 panel._toggleBreakpointsActive();
1275 return true; 1275 return true;
1276 case 'debugger.evaluate-selection': 1276 case 'debugger.evaluate-selection':
1277 var frame = WebInspector.context.flavor(WebInspector.UISourceCodeFrame); 1277 var frame = UI.context.flavor(Sources.UISourceCodeFrame);
1278 if (frame) { 1278 if (frame) {
1279 var text = frame.textEditor.text(frame.textEditor.selection()); 1279 var text = frame.textEditor.text(frame.textEditor.selection());
1280 var executionContext = WebInspector.context.flavor(WebInspector.Execut ionContext); 1280 var executionContext = UI.context.flavor(SDK.ExecutionContext);
1281 if (executionContext) 1281 if (executionContext)
1282 WebInspector.ConsoleModel.evaluateCommandInConsole(executionContext, text); 1282 SDK.ConsoleModel.evaluateCommandInConsole(executionContext, text);
1283 } 1283 }
1284 return true; 1284 return true;
1285 } 1285 }
1286 return false; 1286 return false;
1287 } 1287 }
1288 }; 1288 };
1289 1289
1290 1290
1291 /** 1291 /**
1292 * @unrestricted 1292 * @unrestricted
1293 */ 1293 */
1294 WebInspector.SourcesPanel.WrapperView = class extends WebInspector.VBox { 1294 Sources.SourcesPanel.WrapperView = class extends UI.VBox {
1295 constructor() { 1295 constructor() {
1296 super(); 1296 super();
1297 this.element.classList.add('sources-view-wrapper'); 1297 this.element.classList.add('sources-view-wrapper');
1298 WebInspector.SourcesPanel.WrapperView._instance = this; 1298 Sources.SourcesPanel.WrapperView._instance = this;
1299 this._view = WebInspector.SourcesPanel.instance()._sourcesView; 1299 this._view = Sources.SourcesPanel.instance()._sourcesView;
1300 } 1300 }
1301 1301
1302 /** 1302 /**
1303 * @return {boolean} 1303 * @return {boolean}
1304 */ 1304 */
1305 static isShowing() { 1305 static isShowing() {
1306 return !!WebInspector.SourcesPanel.WrapperView._instance && 1306 return !!Sources.SourcesPanel.WrapperView._instance &&
1307 WebInspector.SourcesPanel.WrapperView._instance.isShowing(); 1307 Sources.SourcesPanel.WrapperView._instance.isShowing();
1308 } 1308 }
1309 1309
1310 /** 1310 /**
1311 * @override 1311 * @override
1312 */ 1312 */
1313 wasShown() { 1313 wasShown() {
1314 if (!WebInspector.SourcesPanel.instance().isShowing()) 1314 if (!Sources.SourcesPanel.instance().isShowing())
1315 this._showViewInWrapper(); 1315 this._showViewInWrapper();
1316 else 1316 else
1317 WebInspector.inspectorView.setDrawerMinimized(true); 1317 UI.inspectorView.setDrawerMinimized(true);
1318 WebInspector.SourcesPanel.updateResizerAndSidebarButtons(WebInspector.Source sPanel.instance()); 1318 Sources.SourcesPanel.updateResizerAndSidebarButtons(Sources.SourcesPanel.ins tance());
1319 } 1319 }
1320 1320
1321 /** 1321 /**
1322 * @override 1322 * @override
1323 */ 1323 */
1324 willHide() { 1324 willHide() {
1325 WebInspector.inspectorView.setDrawerMinimized(false); 1325 UI.inspectorView.setDrawerMinimized(false);
1326 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButtons( WebInspector.SourcesPanel.instance())); 1326 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc es.SourcesPanel.instance()));
1327 } 1327 }
1328 1328
1329 _showViewInWrapper() { 1329 _showViewInWrapper() {
1330 this._view.show(this.element); 1330 this._view.show(this.element);
1331 } 1331 }
1332 }; 1332 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698