| 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.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.XHRBreakpointsSidebarPane = function() | 10 WebInspector.XHRBreakpointsSidebarPane = function() |
| 11 { | 11 { |
| 12 WebInspector.BreakpointsSidebarPaneBase.call(this, WebInspector.UIString("XH
R Breakpoints")); | 12 WebInspector.BreakpointsSidebarPaneBase.call(this, WebInspector.UIString("XH
R Breakpoints")); |
| 13 this._xhrBreakpointsSetting = WebInspector.settings.createLocalSetting("xhrB
reakpoints", []); | 13 this._xhrBreakpointsSetting = WebInspector.settings.createLocalSetting("xhrB
reakpoints", []); |
| 14 | 14 |
| 15 /** @type {!Map.<string, !Element>} */ | 15 /** @type {!Map.<string, !Element>} */ |
| 16 this._breakpointElements = new Map(); | 16 this._breakpointElements = new Map(); |
| 17 | 17 |
| 18 var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add br
eakpoint"), "add-toolbar-item"); | 18 var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add br
eakpoint"), "add-toolbar-item"); |
| 19 addButton.addEventListener("click", this._addButtonClicked.bind(this)); | 19 addButton.addEventListener("click", this._addButtonClicked.bind(this)); |
| 20 this.toolbar().appendToolbarItem(addButton); | 20 this.addToolbarItem(addButton); |
| 21 | 21 |
| 22 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM
enu.bind(this), true); | 22 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM
enu.bind(this), true); |
| 23 | 23 |
| 24 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Browser); | 24 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Browser); |
| 25 } | 25 } |
| 26 | 26 |
| 27 WebInspector.XHRBreakpointsSidebarPane.prototype = { | 27 WebInspector.XHRBreakpointsSidebarPane.prototype = { |
| 28 /** | 28 /** |
| 29 * @override | 29 * @override |
| 30 * @param {!WebInspector.Target} target | 30 * @param {!WebInspector.Target} target |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 var contextMenu = new WebInspector.ContextMenu(event); | 45 var contextMenu = new WebInspector.ContextMenu(event); |
| 46 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakpoint
"), this._addButtonClicked.bind(this)); | 46 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakpoint
"), this._addButtonClicked.bind(this)); |
| 47 contextMenu.show(); | 47 contextMenu.show(); |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 _addButtonClicked: function(event) | 50 _addButtonClicked: function(event) |
| 51 { | 51 { |
| 52 if (event) | 52 if (event) |
| 53 event.consume(); | 53 event.consume(); |
| 54 | 54 |
| 55 this.expandPane(); | 55 this.requestReveal(); |
| 56 | 56 |
| 57 var inputElementContainer = createElementWithClass("p", "breakpoint-cond
ition"); | 57 var inputElementContainer = createElementWithClass("p", "breakpoint-cond
ition"); |
| 58 inputElementContainer.textContent = WebInspector.UIString("Break when UR
L contains:"); | 58 inputElementContainer.textContent = WebInspector.UIString("Break when UR
L contains:"); |
| 59 | 59 |
| 60 var inputElement = inputElementContainer.createChild("span", "editing"); | 60 var inputElement = inputElementContainer.createChild("span", "editing"); |
| 61 inputElement.id = "breakpoint-condition-input"; | 61 inputElement.id = "breakpoint-condition-input"; |
| 62 this.addListElement(inputElementContainer, /** @type {?Element} */ (this
.listElement.firstChild)); | 62 this.addListElement(inputElementContainer, /** @type {?Element} */ (this
.listElement.firstChild)); |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * @param {boolean} accept | 65 * @param {boolean} accept |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.I
nplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, fal
se))); | 212 WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.I
nplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, fal
se))); |
| 213 }, | 213 }, |
| 214 | 214 |
| 215 highlightBreakpoint: function(url) | 215 highlightBreakpoint: function(url) |
| 216 { | 216 { |
| 217 var element = this._breakpointElements.get(url); | 217 var element = this._breakpointElements.get(url); |
| 218 if (!element) | 218 if (!element) |
| 219 return; | 219 return; |
| 220 this.expandPane(); | 220 this.requestReveal(); |
| 221 element.classList.add("breakpoint-hit"); | 221 element.classList.add("breakpoint-hit"); |
| 222 this._highlightedElement = element; | 222 this._highlightedElement = element; |
| 223 }, | 223 }, |
| 224 | 224 |
| 225 clearBreakpointHighlight: function() | 225 clearBreakpointHighlight: function() |
| 226 { | 226 { |
| 227 if (this._highlightedElement) { | 227 if (this._highlightedElement) { |
| 228 this._highlightedElement.classList.remove("breakpoint-hit"); | 228 this._highlightedElement.classList.remove("breakpoint-hit"); |
| 229 delete this._highlightedElement; | 229 delete this._highlightedElement; |
| 230 } | 230 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 246 var breakpoints = this._xhrBreakpointsSetting.get(); | 246 var breakpoints = this._xhrBreakpointsSetting.get(); |
| 247 for (var i = 0; i < breakpoints.length; ++i) { | 247 for (var i = 0; i < breakpoints.length; ++i) { |
| 248 var breakpoint = breakpoints[i]; | 248 var breakpoint = breakpoints[i]; |
| 249 if (breakpoint && typeof breakpoint.url === "string") | 249 if (breakpoint && typeof breakpoint.url === "string") |
| 250 this._setBreakpoint(breakpoint.url, breakpoint.enabled, target); | 250 this._setBreakpoint(breakpoint.url, breakpoint.enabled, target); |
| 251 } | 251 } |
| 252 }, | 252 }, |
| 253 | 253 |
| 254 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype | 254 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype |
| 255 } | 255 } |
| OLD | NEW |