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

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

Issue 350153004: DevTools: Activate breakpoints in breakpointManager (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 /** 26 /**
27 * @constructor 27 * @constructor
28 * @extends {WebInspector.SidebarPane} 28 * @extends {WebInspector.SidebarPane}
29 * @param {!WebInspector.DebuggerModel} debuggerModel
30 * @param {!WebInspector.BreakpointManager} breakpointManager 29 * @param {!WebInspector.BreakpointManager} breakpointManager
31 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho wSourceLineDelegate 30 * @param {function(!WebInspector.UISourceCode, number=, number=, boolean=)} sho wSourceLineDelegate
32 */ 31 */
33 WebInspector.JavaScriptBreakpointsSidebarPane = function(debuggerModel, breakpoi ntManager, showSourceLineDelegate) 32 WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show SourceLineDelegate)
34 { 33 {
35 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); 34 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
36 this._debuggerModel = debuggerModel;
37 this.registerRequiredCSS("breakpointsList.css"); 35 this.registerRequiredCSS("breakpointsList.css");
38 36
39 this._breakpointManager = breakpointManager; 37 this._breakpointManager = breakpointManager;
40 this._showSourceLineDelegate = showSourceLineDelegate; 38 this._showSourceLineDelegate = showSourceLineDelegate;
41 39
42 this.listElement = document.createElement("ol"); 40 this.listElement = document.createElement("ol");
43 this.listElement.className = "breakpoint-list"; 41 this.listElement.className = "breakpoint-list";
44 42
45 this.emptyElement = document.createElement("div"); 43 this.emptyElement = document.createElement("div");
46 this.emptyElement.className = "info"; 44 this.emptyElement.className = "info";
(...skipping 10 matching lines...) Expand all
57 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointAdded, this._breakpointAdded, this); 55 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointAdded, this._breakpointAdded, this);
58 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointRemoved, this._breakpointRemoved, this); 56 this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Even ts.BreakpointRemoved, this._breakpointRemoved, this);
59 57
60 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM enu.bind(this), true); 58 this.emptyElement.addEventListener("contextmenu", this._emptyElementContextM enu.bind(this), true);
61 } 59 }
62 60
63 WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { 61 WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
64 _emptyElementContextMenu: function(event) 62 _emptyElementContextMenu: function(event)
65 { 63 {
66 var contextMenu = new WebInspector.ContextMenu(event); 64 var contextMenu = new WebInspector.ContextMenu(event);
67 var breakpointActive = this._debuggerModel.breakpointsActive(); 65 this._appendBreakpointActiveItem(contextMenu);
68 var breakpointActiveTitle = breakpointActive ?
69 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deact ivate breakpoints" : "Deactivate Breakpoints") :
70 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activ ate breakpoints" : "Activate Breakpoints");
71 contextMenu.appendItem(breakpointActiveTitle, this._debuggerModel.setBre akpointsActive.bind(this._debuggerModel, !breakpointActive));
72 contextMenu.show(); 66 contextMenu.show();
73 }, 67 },
74 68
75 /** 69 /**
70 * @param {!WebInspector.ContextMenu} contextMenu
71 */
72 _appendBreakpointActiveItem: function(contextMenu)
73 {
74 var breakpointActive = this._breakpointManager.breakpointsActive();
75 var breakpointActiveTitle = breakpointActive ?
76 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deact ivate breakpoints" : "Deactivate Breakpoints") :
77 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activ ate breakpoints" : "Activate Breakpoints");
78 contextMenu.appendItem(breakpointActiveTitle, this._breakpointManager.se tBreakpointsActive.bind(this._breakpointManager, !breakpointActive));
79 },
80
81 /**
76 * @param {!WebInspector.Event} event 82 * @param {!WebInspector.Event} event
77 */ 83 */
78 _breakpointAdded: function(event) 84 _breakpointAdded: function(event)
79 { 85 {
80 this._breakpointRemoved(event); 86 this._breakpointRemoved(event);
81 87
82 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (event.data.breakpoint); 88 var breakpoint = /** @type {!WebInspector.BreakpointManager.Breakpoint} */ (event.data.breakpoint);
83 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiL ocation); 89 var uiLocation = /** @type {!WebInspector.UILocation} */ (event.data.uiL ocation);
84 this._addBreakpoint(breakpoint, uiLocation); 90 this._addBreakpoint(breakpoint, uiLocation);
85 }, 91 },
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 207 {
202 var breakpoints = this._items.values(); 208 var breakpoints = this._items.values();
203 var contextMenu = new WebInspector.ContextMenu(event); 209 var contextMenu = new WebInspector.ContextMenu(event);
204 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), breakpoint.remove.bind( breakpoint)); 210 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Remove breakpoint" : "Remove Breakpoint"), breakpoint.remove.bind( breakpoint));
205 if (breakpoints.length > 1) { 211 if (breakpoints.length > 1) {
206 var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCase MenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints"); 212 var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCase MenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");
207 contextMenu.appendItem(removeAllTitle, this._breakpointManager.remov eAllBreakpoints.bind(this._breakpointManager)); 213 contextMenu.appendItem(removeAllTitle, this._breakpointManager.remov eAllBreakpoints.bind(this._breakpointManager));
208 } 214 }
209 215
210 contextMenu.appendSeparator(); 216 contextMenu.appendSeparator();
211 var breakpointActive = this._debuggerModel.breakpointsActive(); 217 this._appendBreakpointActiveItem(contextMenu);
212 var breakpointActiveTitle = breakpointActive ?
213 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Deact ivate breakpoints" : "Deactivate Breakpoints") :
214 WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Activ ate breakpoints" : "Activate Breakpoints");
215 contextMenu.appendItem(breakpointActiveTitle, this._debuggerModel.setBre akpointsActive.bind(this._debuggerModel, !breakpointActive));
216 218
217 function enabledBreakpointCount(breakpoints) 219 function enabledBreakpointCount(breakpoints)
218 { 220 {
219 var count = 0; 221 var count = 0;
220 for (var i = 0; i < breakpoints.length; ++i) { 222 for (var i = 0; i < breakpoints.length; ++i) {
221 if (breakpoints[i].checkbox.checked) 223 if (breakpoints[i].checkbox.checked)
222 count++; 224 count++;
223 } 225 }
224 return count; 226 return count;
225 } 227 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get(); 809 var breakpoints = WebInspector.settings.eventListenerBreakpoints.get();
808 for (var i = 0; i < breakpoints.length; ++i) { 810 for (var i = 0; i < breakpoints.length; ++i) {
809 var breakpoint = breakpoints[i]; 811 var breakpoint = breakpoints[i];
810 if (breakpoint && typeof breakpoint.eventName === "string") 812 if (breakpoint && typeof breakpoint.eventName === "string")
811 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames ); 813 this._setBreakpoint(breakpoint.eventName, breakpoint.targetNames );
812 } 814 }
813 }, 815 },
814 816
815 __proto__: WebInspector.SidebarPane.prototype 817 __proto__: WebInspector.SidebarPane.prototype
816 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698