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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js

Issue 1563113002: DevTools: add a navigator menu with grouping options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 24 matching lines...) Expand all
35 { 35 {
36 WebInspector.Object.call(this); 36 WebInspector.Object.call(this);
37 this._workspace = workspace; 37 this._workspace = workspace;
38 38
39 this._tabbedPane = new WebInspector.TabbedPane(); 39 this._tabbedPane = new WebInspector.TabbedPane();
40 this._tabbedPane.setShrinkableTabs(true); 40 this._tabbedPane.setShrinkableTabs(true);
41 this._tabbedPane.element.classList.add("navigator-tabbed-pane"); 41 this._tabbedPane.element.classList.add("navigator-tabbed-pane");
42 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "navigator-view", this._navigatorViewCreated.bind(this)); 42 this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController (this._tabbedPane, "navigator-view", this._navigatorViewCreated.bind(this));
43 /** @type {!Map.<string, ?WebInspector.NavigatorView>} */ 43 /** @type {!Map.<string, ?WebInspector.NavigatorView>} */
44 this._navigatorViews = new Map(); 44 this._navigatorViews = new Map();
45
46 var toolbar = new WebInspector.Toolbar("");
47 var menuButton = new WebInspector.ToolbarMenuButton(this._populateMenu.bind( this), true);
48 menuButton.setTitle(WebInspector.UIString("More options"));
49 toolbar.appendToolbarItem(menuButton);
50
51 this._tabbedPane.appendAfterTabStrip(toolbar.element);
45 } 52 }
46 53
47 WebInspector.SourcesNavigator.Events = { 54 WebInspector.SourcesNavigator.Events = {
48 SourceSelected: "SourceSelected", 55 SourceSelected: "SourceSelected",
49 SourceRenamed: "SourceRenamed" 56 SourceRenamed: "SourceRenamed"
50 } 57 }
51 58
52 WebInspector.SourcesNavigator.prototype = { 59 WebInspector.SourcesNavigator.prototype = {
53 /** 60 /**
54 * @param {string} id 61 * @param {string} id
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 }, 114 },
108 115
109 /** 116 /**
110 * @param {!WebInspector.Event} event 117 * @param {!WebInspector.Event} event
111 */ 118 */
112 _sourceRenamed: function(event) 119 _sourceRenamed: function(event)
113 { 120 {
114 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.Sourc eRenamed, event.data); 121 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.Sourc eRenamed, event.data);
115 }, 122 },
116 123
124 /**
125 * @param {!WebInspector.ContextMenu} contextMenu
126 */
127 _populateMenu: function(contextMenu)
128 {
129 var groupByFrameSetting = WebInspector.moduleSetting("navigatorGroupByFr ame");
130 var groupByDomainSetting = WebInspector.moduleSetting("navigatorGroupByD omain");
131 var groupByFolderSetting = WebInspector.moduleSetting("navigatorGroupByF older");
132 contextMenu.appendItemsAtLocation("navigatorMenu");
133 contextMenu.appendSeparator();
134 contextMenu.appendCheckboxItem(WebInspector.UIString("Group by frame"), () => groupByFrameSetting.set(!groupByFrameSetting.get()), groupByFrameSetting.g et());
135 contextMenu.appendCheckboxItem(WebInspector.UIString("Group by domain"), () => groupByDomainSetting.set(!groupByDomainSetting.get()), groupByDomainSetti ng.get());
136 contextMenu.appendCheckboxItem(WebInspector.UIString("Group by folder"), () => groupByFolderSetting.set(!groupByFolderSetting.get()), groupByFolderSetti ng.get(), !groupByDomainSetting.get());
137 },
138
117 __proto__: WebInspector.Object.prototype 139 __proto__: WebInspector.Object.prototype
118 } 140 }
119 141
120 /** 142 /**
121 * @constructor 143 * @constructor
122 * @extends {WebInspector.NavigatorView} 144 * @extends {WebInspector.NavigatorView}
123 */ 145 */
146 WebInspector.SourcesNavigatorView = function()
147 {
148 WebInspector.NavigatorView.call(this);
149 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.InspectedURLChanged, this._inspectedURLChanged, this);
150 }
151
152 WebInspector.SourcesNavigatorView.prototype = {
153 /**
154 * @override
155 * @param {!WebInspector.UISourceCode} uiSourceCode
156 * @return {boolean}
157 */
158 accept: function(uiSourceCode)
159 {
160 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
161 return false;
162 return uiSourceCode.project().type() !== WebInspector.projectTypes.Conte ntScripts && uiSourceCode.project().type() !== WebInspector.projectTypes.Snippet s;
163 },
164
165 /**
166 * @param {!WebInspector.Event} event
167 */
168 _inspectedURLChanged: function(event)
169 {
170 var nodes = this._uiSourceCodeNodes.valuesArray();
171 for (var i = 0; i < nodes.length; ++i) {
172 var uiSourceCode = nodes[i].uiSourceCode();
173 var inspectedPageURL = WebInspector.targetManager.inspectedPageURL();
174 if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSour ceCode) === inspectedPageURL)
175 this.revealUISourceCode(uiSourceCode, true);
176 }
177 },
178
179 /**
180 * @override
181 * @param {!WebInspector.UISourceCode} uiSourceCode
182 */
183 uiSourceCodeAdded: function(uiSourceCode)
184 {
185 var inspectedPageURL = WebInspector.targetManager.inspectedPageURL();
186 if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceC ode) === inspectedPageURL)
187 this.revealUISourceCode(uiSourceCode, true);
188 },
189
190 __proto__: WebInspector.NavigatorView.prototype
191 }
192
193 /**
194 * @constructor
195 * @extends {WebInspector.NavigatorView}
196 */
197 WebInspector.ContentScriptsNavigatorView = function()
198 {
199 WebInspector.NavigatorView.call(this);
200 }
201
202 WebInspector.ContentScriptsNavigatorView.prototype = {
203 /**
204 * @override
205 * @param {!WebInspector.UISourceCode} uiSourceCode
206 * @return {boolean}
207 */
208 accept: function(uiSourceCode)
209 {
210 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
211 return false;
212 return uiSourceCode.project().type() === WebInspector.projectTypes.Conte ntScripts;
213 },
214
215 __proto__: WebInspector.NavigatorView.prototype
216 }
217
218 /**
219 * @constructor
220 * @extends {WebInspector.NavigatorView}
221 */
124 WebInspector.SnippetsNavigatorView = function() 222 WebInspector.SnippetsNavigatorView = function()
125 { 223 {
126 WebInspector.NavigatorView.call(this); 224 WebInspector.NavigatorView.call(this);
127 } 225 }
128 226
129 WebInspector.SnippetsNavigatorView.prototype = { 227 WebInspector.SnippetsNavigatorView.prototype = {
130 /** 228 /**
131 * @override 229 * @override
132 * @param {!WebInspector.UISourceCode} uiSourceCode 230 * @param {!WebInspector.UISourceCode} uiSourceCode
133 * @return {boolean} 231 * @return {boolean}
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 /** 293 /**
196 * @override 294 * @override
197 */ 295 */
198 sourceDeleted: function(uiSourceCode) 296 sourceDeleted: function(uiSourceCode)
199 { 297 {
200 this._handleRemoveSnippet(uiSourceCode); 298 this._handleRemoveSnippet(uiSourceCode);
201 }, 299 },
202 300
203 __proto__: WebInspector.NavigatorView.prototype 301 __proto__: WebInspector.NavigatorView.prototype
204 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698