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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
index 4f5997fb61fe47c5e5909f1eb1e285886e420ec8..ed1ed88692890614a98bac560c0d10388f8bd53d 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
@@ -42,6 +42,13 @@ WebInspector.SourcesNavigator = function(workspace)
this._tabbedPaneController = new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane, "navigator-view", this._navigatorViewCreated.bind(this));
/** @type {!Map.<string, ?WebInspector.NavigatorView>} */
this._navigatorViews = new Map();
+
+ var toolbar = new WebInspector.Toolbar("");
+ var menuButton = new WebInspector.ToolbarMenuButton(this._populateMenu.bind(this), true);
+ menuButton.setTitle(WebInspector.UIString("More options"));
+ toolbar.appendToolbarItem(menuButton);
+
+ this._tabbedPane.appendAfterTabStrip(toolbar.element);
}
WebInspector.SourcesNavigator.Events = {
@@ -114,6 +121,21 @@ WebInspector.SourcesNavigator.prototype = {
this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.SourceRenamed, event.data);
},
+ /**
+ * @param {!WebInspector.ContextMenu} contextMenu
+ */
+ _populateMenu: function(contextMenu)
+ {
+ var groupByFrameSetting = WebInspector.moduleSetting("navigatorGroupByFrame");
+ var groupByDomainSetting = WebInspector.moduleSetting("navigatorGroupByDomain");
+ var groupByFolderSetting = WebInspector.moduleSetting("navigatorGroupByFolder");
+ contextMenu.appendItemsAtLocation("navigatorMenu");
+ contextMenu.appendSeparator();
+ contextMenu.appendCheckboxItem(WebInspector.UIString("Group by frame"), () => groupByFrameSetting.set(!groupByFrameSetting.get()), groupByFrameSetting.get());
+ contextMenu.appendCheckboxItem(WebInspector.UIString("Group by domain"), () => groupByDomainSetting.set(!groupByDomainSetting.get()), groupByDomainSetting.get());
+ contextMenu.appendCheckboxItem(WebInspector.UIString("Group by folder"), () => groupByFolderSetting.set(!groupByFolderSetting.get()), groupByFolderSetting.get(), !groupByDomainSetting.get());
+ },
+
__proto__: WebInspector.Object.prototype
}
@@ -121,6 +143,82 @@ WebInspector.SourcesNavigator.prototype = {
* @constructor
* @extends {WebInspector.NavigatorView}
*/
+WebInspector.SourcesNavigatorView = function()
+{
+ WebInspector.NavigatorView.call(this);
+ WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
+}
+
+WebInspector.SourcesNavigatorView.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @return {boolean}
+ */
+ accept: function(uiSourceCode)
+ {
+ if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
+ return false;
+ return uiSourceCode.project().type() !== WebInspector.projectTypes.ContentScripts && uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets;
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _inspectedURLChanged: function(event)
+ {
+ var nodes = this._uiSourceCodeNodes.valuesArray();
+ for (var i = 0; i < nodes.length; ++i) {
+ var uiSourceCode = nodes[i].uiSourceCode();
+ var inspectedPageURL = WebInspector.targetManager.inspectedPageURL();
+ if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedPageURL)
+ this.revealUISourceCode(uiSourceCode, true);
+ }
+ },
+
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ */
+ uiSourceCodeAdded: function(uiSourceCode)
+ {
+ var inspectedPageURL = WebInspector.targetManager.inspectedPageURL();
+ if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedPageURL)
+ this.revealUISourceCode(uiSourceCode, true);
+ },
+
+ __proto__: WebInspector.NavigatorView.prototype
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.NavigatorView}
+ */
+WebInspector.ContentScriptsNavigatorView = function()
+{
+ WebInspector.NavigatorView.call(this);
+}
+
+WebInspector.ContentScriptsNavigatorView.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @return {boolean}
+ */
+ accept: function(uiSourceCode)
+ {
+ if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
+ return false;
+ return uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts;
+ },
+
+ __proto__: WebInspector.NavigatorView.prototype
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.NavigatorView}
+ */
WebInspector.SnippetsNavigatorView = function()
{
WebInspector.NavigatorView.call(this);

Powered by Google App Engine
This is Rietveld 408576698