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

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

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: reupload Created 4 years, 3 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/WorkspaceMappingTip.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js b/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
index cc318cb3ccde22c072778381e1c3d8dec0f5b28e..b9a3e0884e622557364353f2ed5262ec3b01e374 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.js
@@ -20,6 +20,7 @@ WebInspector.WorkspaceMappingTip = function(sourcesPanel, workspace)
if (this._workspaceInfobarDisabledSetting.get() && this._workspaceMappingInfobarDisabledSetting.get())
return;
this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSelected, this._editorSelected.bind(this));
+ WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._bindingCreated, this);
}
WebInspector.WorkspaceMappingTip._infobarSymbol = Symbol("infobar");
@@ -28,6 +29,18 @@ WebInspector.WorkspaceMappingTip.prototype = {
/**
* @param {!WebInspector.Event} event
*/
+ _bindingCreated: function(event)
+ {
+ var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
+ if (binding.network[WebInspector.WorkspaceMappingTip._infobarSymbol])
+ binding.network[WebInspector.WorkspaceMappingTip._infobarSymbol].dispose();
+ if (binding.fileSystem[WebInspector.WorkspaceMappingTip._infobarSymbol])
+ binding.fileSystem[WebInspector.WorkspaceMappingTip._infobarSymbol].dispose();
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
_editorSelected: function(event)
{
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
@@ -50,9 +63,7 @@ WebInspector.WorkspaceMappingTip.prototype = {
// First try mapping filesystem -> network.
if (!this._workspaceMappingInfobarDisabledSetting.get() && uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem) {
- var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode);
- var hasMappings = !!networkURL;
- if (hasMappings)
+ if (WebInspector.persistence.binding(uiSourceCode))
return;
var networkProjects = this._workspace.projectsForType(WebInspector.projectTypes.Network);
@@ -72,10 +83,7 @@ WebInspector.WorkspaceMappingTip.prototype = {
// Then map network -> filesystem.
if (uiSourceCode.project().type() === WebInspector.projectTypes.Network || uiSourceCode.project().type() === WebInspector.projectTypes.ContentScripts) {
// Suggest for localhost only.
- if (!this._isLocalHost(uiSourceCode.url()))
- return;
- var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode);
- if (WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(networkURL) !== uiSourceCode)
+ if (!this._isLocalHost(uiSourceCode.url()) || WebInspector.persistence.binding(uiSourceCode))
return;
var filesystemProjects = this._workspace.projectsForType(WebInspector.projectTypes.FileSystem);

Powered by Google App Engine
This is Rietveld 408576698