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

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

Issue 400633003: DevTools: introduce multitarget model listeners (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 importScript("SourcesView.js"); 51 importScript("SourcesView.js");
52 52
53 // Search results pane 53 // Search results pane
54 importScript("AdvancedSearchView.js"); 54 importScript("AdvancedSearchView.js");
55 importScript("FileBasedSearchResultsPane.js"); 55 importScript("FileBasedSearchResultsPane.js");
56 importScript("SourcesSearchScope.js"); 56 importScript("SourcesSearchScope.js");
57 57
58 /** 58 /**
59 * @constructor 59 * @constructor
60 * @implements {WebInspector.ContextMenu.Provider} 60 * @implements {WebInspector.ContextMenu.Provider}
61 * @implements {WebInspector.TargetManager.Observer}
62 * @extends {WebInspector.Panel} 61 * @extends {WebInspector.Panel}
63 * @param {!WebInspector.Workspace=} workspaceForTest 62 * @param {!WebInspector.Workspace=} workspaceForTest
64 */ 63 */
65 WebInspector.SourcesPanel = function(workspaceForTest) 64 WebInspector.SourcesPanel = function(workspaceForTest)
66 { 65 {
67 WebInspector.Panel.call(this, "sources"); 66 WebInspector.Panel.call(this, "sources");
68 this.registerRequiredCSS("sourcesPanel.css"); 67 this.registerRequiredCSS("sourcesPanel.css");
69 new WebInspector.UpgradeFileSystemDropTarget(this.element); 68 new WebInspector.UpgradeFileSystemDropTarget(this.element);
70 69
71 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); 70 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 this._extensionSidebarPanes = []; 131 this._extensionSidebarPanes = [];
133 this._installDebuggerSidebarController(); 132 this._installDebuggerSidebarController();
134 133
135 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); 134 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this));
136 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); 135 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this));
137 this._dockSideChanged(); 136 this._dockSideChanged();
138 137
139 this._updateDebuggerButtons(); 138 this._updateDebuggerButtons();
140 this._pauseOnExceptionEnabledChanged(); 139 this._pauseOnExceptionEnabledChanged();
141 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionEnabledChanged, this); 140 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionEnabledChanged, this);
142 WebInspector.targetManager.observeTargets(this);
143 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); 141 this._setTarget(WebInspector.context.flavor(WebInspector.Target));
144 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); 142 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is);
145 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); 143 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this);
144 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this );
145 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasDisabled, this._debuggerReset, this);
146 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
147 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
148 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.CallFrameSelected, this._callFrameSelected, this);
149 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame, this._ consoleCommandEvaluatedInSelectedCallFrame, this);
150 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
146 } 151 }
147 152
148 WebInspector.SourcesPanel.minToolbarWidth = 215; 153 WebInspector.SourcesPanel.minToolbarWidth = 215;
149 154
150 WebInspector.SourcesPanel.prototype = { 155 WebInspector.SourcesPanel.prototype = {
151 /** 156 /**
152 * @param {!WebInspector.Target} target
153 */
154 targetAdded: function(target)
155 {
156 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasEnabled, this._debuggerWasEnabled, this);
157 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasDisabled, this._debuggerReset, this);
158 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerPaused, this._debuggerPaused, this);
159 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerResumed, this._debuggerResumed, this);
160 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. CallFrameSelected, this._callFrameSelected, this);
161 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSelec tedCallFrame, this);
162 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this);
163 },
164
165 /**
166 * @param {!WebInspector.Target} target
167 */
168 targetRemoved: function(target)
169 {
170 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasEnabled, this._debuggerWasEnabled, this);
171 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasDisabled, this._debuggerReset, this);
172 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerPaused, this._debuggerPaused, this);
173 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerResumed, this._debuggerResumed, this);
174 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.CallFrameSelected, this._callFrameSelected, this);
175 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSe lectedCallFrame, this);
176 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this);
177 },
178
179 /**
180 * @param {?WebInspector.Target} target 157 * @param {?WebInspector.Target} target
181 */ 158 */
182 _setTarget: function(target) 159 _setTarget: function(target)
183 { 160 {
184 if (!target) 161 if (!target)
185 return; 162 return;
186 163
187 if (target.debuggerModel.isPaused()) { 164 if (target.debuggerModel.isPaused()) {
188 this._showDebuggerPausedDetails(/** @type {!WebInspector.DebuggerPau sedDetails} */ (target.debuggerModel.debuggerPausedDetails())); 165 this._showDebuggerPausedDetails(/** @type {!WebInspector.DebuggerPau sedDetails} */ (target.debuggerModel.debuggerPausedDetails()));
189 var callFrame = target.debuggerModel.selectedCallFrame(); 166 var callFrame = target.debuggerModel.selectedCallFrame();
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 */ 1452 */
1476 handleAction: function() 1453 handleAction: function()
1477 { 1454 {
1478 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp ectorView.showPanel("sources")); 1455 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp ectorView.showPanel("sources"));
1479 if (!panel) 1456 if (!panel)
1480 return false; 1457 return false;
1481 panel.togglePause(); 1458 panel.togglePause();
1482 return true; 1459 return true;
1483 } 1460 }
1484 } 1461 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698