OLD | NEW |
---|---|
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.BreakpointsSidebarPaneBase} | 7 * @extends {WebInspector.BreakpointsSidebarPaneBase} |
8 * @implements {WebInspector.ContextFlavorListener} | |
8 * @implements {WebInspector.TargetManager.Observer} | 9 * @implements {WebInspector.TargetManager.Observer} |
9 * @implements {WebInspector.ToolbarItem.ItemsProvider} | 10 * @implements {WebInspector.ToolbarItem.ItemsProvider} |
10 */ | 11 */ |
11 WebInspector.XHRBreakpointsSidebarPane = function() | 12 WebInspector.XHRBreakpointsSidebarPane = function() |
12 { | 13 { |
13 WebInspector.BreakpointsSidebarPaneBase.call(this); | 14 WebInspector.BreakpointsSidebarPaneBase.call(this); |
14 this._xhrBreakpointsSetting = WebInspector.settings.createLocalSetting("xhrB reakpoints", []); | 15 this._xhrBreakpointsSetting = WebInspector.settings.createLocalSetting("xhrB reakpoints", []); |
15 | 16 |
16 /** @type {!Map.<string, !Element>} */ | 17 /** @type {!Map.<string, !Element>} */ |
17 this._breakpointElements = new Map(); | 18 this._breakpointElements = new Map(); |
18 | 19 |
19 this._addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add breakpoint"), "add-toolbar-item"); | 20 this._addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add breakpoint"), "add-toolbar-item"); |
20 this._addButton.addEventListener("click", this._addButtonClicked.bind(this)) ; | 21 this._addButton.addEventListener("click", this._addButtonClicked.bind(this)) ; |
21 | 22 |
22 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM enu.bind(this), true); | 23 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM enu.bind(this), true); |
23 | |
24 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser); | 24 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser); |
25 this._update(); | |
25 } | 26 } |
26 | 27 |
27 WebInspector.XHRBreakpointsSidebarPane.prototype = { | 28 WebInspector.XHRBreakpointsSidebarPane.prototype = { |
28 /** | 29 /** |
29 * @override | 30 * @override |
30 * @param {!WebInspector.Target} target | 31 * @param {!WebInspector.Target} target |
31 */ | 32 */ |
32 targetAdded: function(target) | 33 targetAdded: function(target) |
33 { | 34 { |
34 this._restoreBreakpoints(target); | 35 this._restoreBreakpoints(target); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 this._removeBreakpoint(url); | 215 this._removeBreakpoint(url); |
215 this._setBreakpoint(text, element._checkboxElement.checked); | 216 this._setBreakpoint(text, element._checkboxElement.checked); |
216 this._saveBreakpoints(); | 217 this._saveBreakpoints(); |
217 } else | 218 } else |
218 element.classList.remove("hidden"); | 219 element.classList.remove("hidden"); |
219 } | 220 } |
220 | 221 |
221 WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.I nplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, fal se))); | 222 WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.I nplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, fal se))); |
222 }, | 223 }, |
223 | 224 |
225 | |
dgozman
2016/08/15 21:31:03
style: extra blank line
| |
224 /** | 226 /** |
225 * @override | 227 * @override |
226 * @param {?WebInspector.DebuggerPausedDetails} details | 228 * @param {?Object} object |
227 */ | 229 */ |
228 highlightDetails: function(details) | 230 flavorChanged: function(object) |
229 { | 231 { |
232 this._update(); | |
233 }, | |
234 | |
235 _update: function() | |
236 { | |
237 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDet ails); | |
230 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso n.XHR) { | 238 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso n.XHR) { |
231 if (this._highlightedElement) { | 239 if (this._highlightedElement) { |
232 this._highlightedElement.classList.remove("breakpoint-hit"); | 240 this._highlightedElement.classList.remove("breakpoint-hit"); |
233 delete this._highlightedElement; | 241 delete this._highlightedElement; |
234 } | 242 } |
235 return; | 243 return; |
236 } | 244 } |
237 var url = details.auxData["breakpointURL"]; | 245 var url = details.auxData["breakpointURL"]; |
238 var element = this._breakpointElements.get(url); | 246 var element = this._breakpointElements.get(url); |
239 if (!element) | 247 if (!element) |
(...skipping 19 matching lines...) Expand all Loading... | |
259 var breakpoints = this._xhrBreakpointsSetting.get(); | 267 var breakpoints = this._xhrBreakpointsSetting.get(); |
260 for (var i = 0; i < breakpoints.length; ++i) { | 268 for (var i = 0; i < breakpoints.length; ++i) { |
261 var breakpoint = breakpoints[i]; | 269 var breakpoint = breakpoints[i]; |
262 if (breakpoint && typeof breakpoint.url === "string") | 270 if (breakpoint && typeof breakpoint.url === "string") |
263 this._setBreakpoint(breakpoint.url, breakpoint.enabled, target); | 271 this._setBreakpoint(breakpoint.url, breakpoint.enabled, target); |
264 } | 272 } |
265 }, | 273 }, |
266 | 274 |
267 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype | 275 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype |
268 } | 276 } |
OLD | NEW |