Commit e3009ff5 authored by lushnikov's avatar lushnikov Committed by Commit bot

DevTools: hide new navigator interface behind experiment

This patch hides the new navigator design behind the experiment.

BUG=none
R=pfeldman, dgozman

Review-Url: https://codereview.chromium.org/2388303003
Cr-Commit-Position: refs/heads/master@{#422872}
parent 46e4de5d
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
function test() function test()
{ {
Runtime.experiments.enableForTest("persistence2");
var sourcesNavigator = new WebInspector.SourcesNavigatorView(); var sourcesNavigator = new WebInspector.SourcesNavigatorView();
sourcesNavigator.show(WebInspector.inspectorView.element); sourcesNavigator.show(WebInspector.inspectorView.element);
var fs = new InspectorTest.TestFileSystem("file:///var/www"); var fs = new InspectorTest.TestFileSystem("file:///var/www");
......
...@@ -60,8 +60,14 @@ WebInspector.NavigatorView = function() ...@@ -60,8 +60,14 @@ WebInspector.NavigatorView = function()
this._initGrouping(); this._initGrouping();
WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this); WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this);
WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this); WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this);
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._onBindingChanged, this);
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._onBindingChanged, this); if (Runtime.experiments.isEnabled("persistence2")) {
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._onBindingChanged, this);
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._onBindingChanged, this);
} else {
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._onBindingCreated, this);
WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._onBindingRemoved, this);
}
WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.NameChanged, this._targetNameChanged, this); WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.NameChanged, this._targetNameChanged, this);
WebInspector.targetManager.observeTargets(this); WebInspector.targetManager.observeTargets(this);
...@@ -156,6 +162,24 @@ WebInspector.NavigatorView.appendSearchItem = function(contextMenu, path) ...@@ -156,6 +162,24 @@ WebInspector.NavigatorView.appendSearchItem = function(contextMenu, path)
} }
WebInspector.NavigatorView.prototype = { WebInspector.NavigatorView.prototype = {
/**
* @param {!WebInspector.Event} event
*/
_onBindingCreated: function(event)
{
var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
this._removeUISourceCode(binding.network);
},
/**
* @param {!WebInspector.Event} event
*/
_onBindingRemoved: function(event)
{
var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
this._addUISourceCode(binding.network);
},
/** /**
* @param {!WebInspector.Event} event * @param {!WebInspector.Event} event
*/ */
...@@ -240,6 +264,10 @@ WebInspector.NavigatorView.prototype = { ...@@ -240,6 +264,10 @@ WebInspector.NavigatorView.prototype = {
if (!this.accept(uiSourceCode)) if (!this.accept(uiSourceCode))
return; return;
var binding = WebInspector.persistence.binding(uiSourceCode);
if (!Runtime.experiments.isEnabled("persistence2") && binding && binding.network === uiSourceCode)
return;
var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap(); var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap();
var path; var path;
if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem)
...@@ -1301,7 +1329,7 @@ WebInspector.NavigatorUISourceCodeTreeNode.prototype = { ...@@ -1301,7 +1329,7 @@ WebInspector.NavigatorUISourceCodeTreeNode.prototype = {
titleText = "*" + titleText; titleText = "*" + titleText;
var binding = WebInspector.persistence.binding(this._uiSourceCode); var binding = WebInspector.persistence.binding(this._uiSourceCode);
if (binding) { if (binding && Runtime.experiments.isEnabled("persistence2")) {
var titleElement = createElement("span"); var titleElement = createElement("span");
titleElement.textContent = titleText; titleElement.textContent = titleText;
var status = titleElement.createChild("span"); var status = titleElement.createChild("span");
...@@ -1454,7 +1482,8 @@ WebInspector.NavigatorFolderTreeNode.prototype = { ...@@ -1454,7 +1482,8 @@ WebInspector.NavigatorFolderTreeNode.prototype = {
if (!this._treeElement || this._project.type() !== WebInspector.projectTypes.FileSystem) if (!this._treeElement || this._project.type() !== WebInspector.projectTypes.FileSystem)
return; return;
var absoluteFileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()) + "/" + this._folderPath; var absoluteFileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()) + "/" + this._folderPath;
this._treeElement.listItemElement.classList.toggle("has-mapped-files", WebInspector.persistence.filePathHasBindings(absoluteFileSystemPath)); var hasMappedFiles = Runtime.experiments.isEnabled("persistence2") ? WebInspector.persistence.filePathHasBindings(absoluteFileSystemPath) : true;
this._treeElement.listItemElement.classList.toggle("has-mapped-files", hasMappedFiles);
}, },
/** /**
...@@ -1631,6 +1660,10 @@ WebInspector.NavigatorGroupTreeNode.prototype = { ...@@ -1631,6 +1660,10 @@ WebInspector.NavigatorGroupTreeNode.prototype = {
{ {
if (!this._treeElement || this._project.type() !== WebInspector.projectTypes.FileSystem) if (!this._treeElement || this._project.type() !== WebInspector.projectTypes.FileSystem)
return; return;
if (!Runtime.experiments.isEnabled("persistence2")) {
this._treeElement.listItemElement.classList.add("has-mapped-files");
return;
}
var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()); var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemPath(this._project.id());
var wasActive = this._treeElement.listItemElement.classList.contains("has-mapped-files"); var wasActive = this._treeElement.listItemElement.classList.contains("has-mapped-files");
var isActive = WebInspector.persistence.filePathHasBindings(fileSystemPath); var isActive = WebInspector.persistence.filePathHasBindings(fileSystemPath);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment