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

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

Issue 2384783003: DevTools: split Sources tree into Network and Filesystem trees. (Closed)
Patch Set: review comments addressed Created 4 years, 2 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 73f94fa7a6decef8c50dabeec7ebd7e78ffa3266..b80abb420e442970e64a9e32c0622547a65809cb 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
@@ -78,6 +78,104 @@ WebInspector.SourcesNavigatorView.prototype = {
this.revealUISourceCode(uiSourceCode, true);
},
+ /**
+ * @override
+ * @param {!Event} event
+ */
+ handleContextMenu: function(event)
+ {
+ var contextMenu = new WebInspector.ContextMenu(event);
+ WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
+ contextMenu.show();
+ },
+
+ __proto__: WebInspector.NavigatorView.prototype
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.NavigatorView}
+ */
+WebInspector.NetworkNavigatorView = function()
+{
+ WebInspector.NavigatorView.call(this);
+ WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
+}
+
+WebInspector.NetworkNavigatorView.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @return {boolean}
+ */
+ accept: function(uiSourceCode)
+ {
+ return uiSourceCode.project().type() === WebInspector.projectTypes.Network;
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _inspectedURLChanged: function(event)
+ {
+ var mainTarget = WebInspector.targetManager.mainTarget();
+ if (event.data !== mainTarget)
+ return;
+ var inspectedURL = mainTarget && mainTarget.inspectedURL();
+ if (!inspectedURL)
+ return
+ for (var node of this._uiSourceCodeNodes.valuesArray()) {
+ var uiSourceCode = node.uiSourceCode();
+ if (uiSourceCode.url() === inspectedURL)
+ this.revealUISourceCode(uiSourceCode, true);
+ }
+ },
+
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ */
+ uiSourceCodeAdded: function(uiSourceCode)
+ {
+ var inspectedPageURL = WebInspector.targetManager.mainTarget().inspectedURL();
+ if (uiSourceCode.url() === inspectedPageURL)
+ this.revealUISourceCode(uiSourceCode, true);
+ },
+
+ __proto__: WebInspector.NavigatorView.prototype
+}
+
+/**
+ * @constructor
+ * @extends {WebInspector.NavigatorView}
+ */
+WebInspector.FilesNavigatorView = function()
+{
+ WebInspector.NavigatorView.call(this);
+}
+
+WebInspector.FilesNavigatorView.prototype = {
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @return {boolean}
+ */
+ accept: function(uiSourceCode)
+ {
+ return uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem;
+ },
+
+ /**
+ * @override
+ * @param {!Event} event
+ */
+ handleContextMenu: function(event)
+ {
+ var contextMenu = new WebInspector.ContextMenu(event);
+ WebInspector.NavigatorView.appendAddFolderItem(contextMenu);
+ contextMenu.show();
+ },
+
__proto__: WebInspector.NavigatorView.prototype
}
@@ -98,8 +196,6 @@ WebInspector.ContentScriptsNavigatorView.prototype = {
*/
accept: function(uiSourceCode)
{
- if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
- return false;
return uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts;
},
@@ -123,8 +219,6 @@ WebInspector.SnippetsNavigatorView.prototype = {
*/
accept: function(uiSourceCode)
{
- if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
- return false;
return uiSourceCode.project().type() === WebInspector.projectTypes.Snippets;
},

Powered by Google App Engine
This is Rietveld 408576698