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

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

Issue 2826173003: DevTools: prepare Navigator and Network Project for merging uiSourceCodes (Closed)
Patch Set: address comments Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
index a1ce9bf75696b44b07321de24613ec4ab9fc62e0..4862b79de29e4de7917ea4fa04df9366501bc34b 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
@@ -243,20 +243,6 @@ Sources.NavigatorView = class extends UI.VBox {
/**
* @param {!Workspace.UISourceCode} uiSourceCode
- * @return {?SDK.ResourceTreeFrame}
- */
- _uiSourceCodeFrame(uiSourceCode) {
- var frame = Bindings.NetworkProject.frameForProject(uiSourceCode.project());
- if (!frame) {
- var target = Bindings.NetworkProject.targetForProject(uiSourceCode.project());
- var resourceTreeModel = target && target.model(SDK.ResourceTreeModel);
- frame = resourceTreeModel && resourceTreeModel.mainFrame;
- }
- return frame;
- }
-
- /**
- * @param {!Workspace.UISourceCode} uiSourceCode
*/
_addUISourceCode(uiSourceCode) {
if (!this.accept(uiSourceCode))
@@ -275,13 +261,24 @@ Sources.NavigatorView = class extends UI.VBox {
var project = uiSourceCode.project();
var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode);
- var frame = this._uiSourceCodeFrame(uiSourceCode);
-
- var folderNode =
- this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap);
- var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode);
- this._uiSourceCodeNodes.set(uiSourceCode, [uiSourceCodeNode]);
- folderNode.appendChild(uiSourceCodeNode);
+ var frames = Bindings.NetworkProject.framesForUISourceCode(uiSourceCode);
+ var uiSourceCodeNodes = [];
+ if (frames.length) {
+ for (var frame of frames) {
+ var folderNode =
+ this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap);
+ var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode, frame);
+ folderNode.appendChild(uiSourceCodeNode);
+ uiSourceCodeNodes.push(uiSourceCodeNode);
+ }
+ } else {
+ var folderNode =
+ this._folderNode(uiSourceCode, project, target, null, uiSourceCode.origin(), path, isFromSourceMap);
+ var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode, null);
+ folderNode.appendChild(uiSourceCodeNode);
+ uiSourceCodeNodes.push(uiSourceCodeNode);
+ }
+ this._uiSourceCodeNodes.set(uiSourceCode, uiSourceCodeNodes);
this.uiSourceCodeAdded(uiSourceCode);
}
@@ -530,7 +527,7 @@ Sources.NavigatorView = class extends UI.VBox {
var project = uiSourceCode.project();
var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode);
- var frame = this._uiSourceCodeFrame(uiSourceCode);
+ var frame = node.frame();
var parentNode = node.parent;
parentNode.removeChild(node);
@@ -1214,13 +1211,22 @@ Sources.NavigatorUISourceCodeTreeNode = class extends Sources.NavigatorTreeNode
/**
* @param {!Sources.NavigatorView} navigatorView
* @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {?SDK.ResourceTreeFrame} frame
*/
- constructor(navigatorView, uiSourceCode) {
+ constructor(navigatorView, uiSourceCode, frame) {
super(uiSourceCode.project().id() + ':' + uiSourceCode.url(), Sources.NavigatorView.Types.File);
this._navigatorView = navigatorView;
this._uiSourceCode = uiSourceCode;
this._treeElement = null;
this._eventListeners = [];
+ this._frame = frame;
+ }
+
+ /**
+ * @return {?SDK.ResourceTreeFrame}
+ */
+ frame() {
+ return this._frame;
}
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698