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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js

Issue 2234193002: DevTools: migrate some of the sources panel sidebar panes to view management, allow view toolbars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
index e6a37eddd4c5baae142401ea76881f1de64ac0fb..0e228dd5add1220aadc4742bb6cec1c50fce8484 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
@@ -6,18 +6,18 @@
* @constructor
* @extends {WebInspector.BreakpointsSidebarPaneBase}
* @implements {WebInspector.TargetManager.Observer}
+ * @implements {WebInspector.ToolbarItem.ItemsProvider}
*/
WebInspector.XHRBreakpointsSidebarPane = function()
{
- WebInspector.BreakpointsSidebarPaneBase.call(this, WebInspector.UIString("XHR Breakpoints"));
+ WebInspector.BreakpointsSidebarPaneBase.call(this);
this._xhrBreakpointsSetting = WebInspector.settings.createLocalSetting("xhrBreakpoints", []);
/** @type {!Map.<string, !Element>} */
this._breakpointElements = new Map();
- var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add breakpoint"), "add-toolbar-item");
- addButton.addEventListener("click", this._addButtonClicked.bind(this));
- this.addToolbarItem(addButton);
+ this._addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add breakpoint"), "add-toolbar-item");
+ this._addButton.addEventListener("click", this._addButtonClicked.bind(this));
this.emptyElement.addEventListener("contextmenu", this._emptyElementContextMenu.bind(this), true);
@@ -40,6 +40,15 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = {
*/
targetRemoved: function(target) { },
+ /**
+ * @override
+ * @return {!Array<!WebInspector.ToolbarItem>}
+ */
+ toolbarItems: function()
+ {
+ return [this._addButton];
+ },
+
_emptyElementContextMenu: function(event)
{
var contextMenu = new WebInspector.ContextMenu(event);
@@ -52,7 +61,7 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = {
if (event)
event.consume();
- this.revealView();
+ WebInspector.viewManager.revealViewWithWidget(this);
var inputElementContainer = createElementWithClass("p", "breakpoint-condition");
inputElementContainer.textContent = WebInspector.UIString("Break when URL contains:");
@@ -212,24 +221,28 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = {
WebInspector.InplaceEditor.startEditing(inputElement, new WebInspector.InplaceEditor.Config(finishEditing.bind(this, true), finishEditing.bind(this, false)));
},
- highlightBreakpoint: function(url)
+ /**
+ * @override
+ * @param {?WebInspector.DebuggerPausedDetails} details
+ */
+ highlightDetails: function(details)
{
+ if (!details || details.reason !== WebInspector.DebuggerModel.BreakReason.XHR) {
+ if (this._highlightedElement) {
+ this._highlightedElement.classList.remove("breakpoint-hit");
+ delete this._highlightedElement;
+ }
+ return;
+ }
+ var url = details.auxData["breakpointURL"];
var element = this._breakpointElements.get(url);
if (!element)
return;
- this.revealView();
+ WebInspector.viewManager.revealViewWithWidget(this);
element.classList.add("breakpoint-hit");
this._highlightedElement = element;
},
- clearBreakpointHighlight: function()
- {
- if (this._highlightedElement) {
- this._highlightedElement.classList.remove("breakpoint-hit");
- delete this._highlightedElement;
- }
- },
-
_saveBreakpoints: function()
{
var breakpoints = [];

Powered by Google App Engine
This is Rietveld 408576698