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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js

Issue 2238003002: DevTools: migrate sources panel sidebar to views. (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.BreakpointsSidebarPaneBase} 33 * @extends {WebInspector.BreakpointsSidebarPaneBase}
34 * @implements {WebInspector.ContextFlavorListener}
34 */ 35 */
35 WebInspector.DOMBreakpointsSidebarPane = function() 36 WebInspector.DOMBreakpointsSidebarPane = function()
36 { 37 {
37 WebInspector.BreakpointsSidebarPaneBase.call(this); 38 WebInspector.BreakpointsSidebarPaneBase.call(this);
38 this._domBreakpointsSetting = WebInspector.settings.createLocalSetting("domB reakpoints", []); 39 this._domBreakpointsSetting = WebInspector.settings.createLocalSetting("domB reakpoints", []);
39 this.listElement.classList.add("dom-breakpoints-list"); 40 this.listElement.classList.add("dom-breakpoints-list");
40 41
41 this._breakpointElements = {}; 42 this._breakpointElements = {};
42 43
43 this._breakpointTypes = { 44 this._breakpointTypes = {
44 SubtreeModified: "subtree-modified", 45 SubtreeModified: "subtree-modified",
45 AttributeModified: "attribute-modified", 46 AttributeModified: "attribute-modified",
46 NodeRemoved: "node-removed" 47 NodeRemoved: "node-removed"
47 }; 48 };
48 this._breakpointTypeLabels = {}; 49 this._breakpointTypeLabels = {};
49 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe ctor.UIString("Subtree Modified"); 50 this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified] = WebInspe ctor.UIString("Subtree Modified");
50 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns pector.UIString("Attribute Modified"); 51 this._breakpointTypeLabels[this._breakpointTypes.AttributeModified] = WebIns pector.UIString("Attribute Modified");
51 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector .UIString("Node Removed"); 52 this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved] = WebInspector .UIString("Node Removed");
52 53
53 this._contextMenuLabels = {}; 54 this._contextMenuLabels = {};
54 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto r.UIString.capitalize("Subtree ^modifications"); 55 this._contextMenuLabels[this._breakpointTypes.SubtreeModified] = WebInspecto r.UIString.capitalize("Subtree ^modifications");
55 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec tor.UIString.capitalize("Attributes ^modifications"); 56 this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspec tor.UIString.capitalize("Attributes ^modifications");
56 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI String.capitalize("Node ^removal"); 57 this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UI String.capitalize("Node ^removal");
57 58
59 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this);
58 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.InspectedURLChanged, this._inspectedURLChanged, this); 60 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.InspectedURLChanged, this._inspectedURLChanged, this);
59 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeRemoved, this._nodeRemoved, this); 61 this._inspectedURL = WebInspector.targetManager.inspectedURL();
62 this._update();
60 } 63 }
61 64
62 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker"; 65 WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker";
63 66
64 WebInspector.DOMBreakpointsSidebarPane.prototype = { 67 WebInspector.DOMBreakpointsSidebarPane.prototype = {
65 _inspectedURLChanged: function(event) 68 _inspectedURLChanged: function()
66 { 69 {
67 var target = /** @type {!WebInspector.Target} */ (event.data);
68 if (target !== WebInspector.targetManager.mainTarget())
69 return;
70 this._breakpointElements = {}; 70 this._breakpointElements = {};
71 this.reset(); 71 this.reset();
72 this._inspectedURL = target.inspectedURL().removeURLFragment(); 72 this._inspectedURL = WebInspector.targetManager.inspectedURL();
73 }, 73 },
74 74
75 /** 75 /**
76 * @param {!WebInspector.DOMNode} node 76 * @param {!WebInspector.DOMNode} node
77 * @param {!WebInspector.ContextMenu} contextMenu 77 * @param {!WebInspector.ContextMenu} contextMenu
78 * @param {boolean} createSubMenu 78 * @param {boolean} createSubMenu
79 */ 79 */
80 populateNodeContextMenu: function(node, contextMenu, createSubMenu) 80 populateNodeContextMenu: function(node, contextMenu, createSubMenu)
81 { 81 {
82 if (node.pseudoType()) 82 if (node.pseudoType())
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 { 315 {
316 if (event.target.checked) 316 if (event.target.checked)
317 node.target().domdebuggerAgent().setDOMBreakpoint(node.id, type); 317 node.target().domdebuggerAgent().setDOMBreakpoint(node.id, type);
318 else 318 else
319 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type); 319 node.target().domdebuggerAgent().removeDOMBreakpoint(node.id, type);
320 this._saveBreakpoints(); 320 this._saveBreakpoints();
321 }, 321 },
322 322
323 /** 323 /**
324 * @override 324 * @override
325 * @param {?WebInspector.DebuggerPausedDetails} details 325 * @param {?Object} object
326 */ 326 */
327 highlightDetails: function(details) 327 flavorChanged: function(object)
328 { 328 {
329 this._update();
330 },
331
332 _update: function()
333 {
334 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDet ails);
329 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso n.DOM) { 335 if (!details || details.reason !== WebInspector.DebuggerModel.BreakReaso n.DOM) {
330 if (this._highlightedElement) { 336 if (this._highlightedElement) {
331 this._highlightedElement.classList.remove("breakpoint-hit"); 337 this._highlightedElement.classList.remove("breakpoint-hit");
332 delete this._highlightedElement; 338 delete this._highlightedElement;
333 } 339 }
334 return; 340 return;
335 } 341 }
336 var auxData = details.auxData; 342 var auxData = details.auxData;
337 var breakpointId = this._createBreakpointId(auxData.nodeId, auxData.type ); 343 var breakpointId = this._createBreakpointId(auxData.nodeId, auxData.type );
338 var element = this._breakpointElements[breakpointId]; 344 var element = this._breakpointElements[breakpointId];
339 if (!element) 345 if (!element)
340 return; 346 return;
341 WebInspector.viewManager.revealViewWithWidget(this); 347 WebInspector.viewManager.showView("sources.domBreakpoints");
342 element.classList.add("breakpoint-hit"); 348 element.classList.add("breakpoint-hit");
343 this._highlightedElement = element; 349 this._highlightedElement = element;
344 }, 350 },
345 351
346 /** 352 /**
347 * @param {number} nodeId 353 * @param {number} nodeId
348 * @param {!DOMDebuggerAgent.DOMBreakpointType} type 354 * @param {!DOMDebuggerAgent.DOMBreakpointType} type
349 */ 355 */
350 _createBreakpointId: function(nodeId, type) 356 _createBreakpointId: function(nodeId, type)
351 { 357 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 pane.show(this.element); 433 pane.show(this.element);
428 }, 434 },
429 435
430 __proto__: WebInspector.VBox.prototype 436 __proto__: WebInspector.VBox.prototype
431 } 437 }
432 438
433 /** 439 /**
434 * @type {!WebInspector.DOMBreakpointsSidebarPane} 440 * @type {!WebInspector.DOMBreakpointsSidebarPane}
435 */ 441 */
436 WebInspector.domBreakpointsSidebarPane; 442 WebInspector.domBreakpointsSidebarPane;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698