Index: third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js b/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js |
index 7397630d721247c39a2e6b45fe90dfaaee8b22f9..ec7df79900ef1a7c91bbd6332bd9028b2d2cd3b9 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js |
@@ -63,6 +63,9 @@ WebInspector.TabbedEditorContainer = function(delegate, setting, placeholderText |
this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabClosed, this._tabClosed, this); |
this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSelected, this._tabSelected, this); |
+ WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._onBindingCreated, this); |
+ WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._onBindingRemoved, this); |
+ |
this._tabIds = new Map(); |
this._files = {}; |
@@ -81,6 +84,26 @@ WebInspector.TabbedEditorContainer._tabId = 0; |
WebInspector.TabbedEditorContainer.maximalPreviouslyViewedFilesCount = 30; |
WebInspector.TabbedEditorContainer.prototype = { |
+ _onBindingCreated: function(event) |
dgozman
2016/09/22 19:55:54
JSDoc
lushnikov
2016/09/23 21:56:13
Done.
|
+ { |
+ var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data); |
+ var persistentTab = this._tabIds.get(binding.persistent); |
+ if (!persistentTab) |
+ return; |
+ |
+ this._closeTabs([persistentTab]); |
+ this.addUISourceCode(binding.network); |
dgozman
2016/09/22 19:55:54
Should preserve focus if it was on closed tab.
lushnikov
2016/09/23 21:56:13
Done.
|
+ }, |
+ |
+ _onBindingRemoved: function(event) |
dgozman
2016/09/22 19:55:54
JSDoc
lushnikov
2016/09/23 21:56:13
Done.
|
+ { |
+ var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data); |
+ var networkTab = this._tabIds.get(binding.network); |
+ if (!networkTab) |
+ return; |
+ this._appendFileTab(binding.persistent, false); |
+ }, |
+ |
/** |
* @return {!WebInspector.Widget} |
*/ |
@@ -201,6 +224,8 @@ WebInspector.TabbedEditorContainer.prototype = { |
*/ |
_innerShowFile: function(uiSourceCode, userGesture) |
{ |
+ var binding = WebInspector.persistence.binding(uiSourceCode) |
dgozman
2016/09/22 19:55:54
semicolon
lushnikov
2016/09/23 21:56:13
Done.
|
+ uiSourceCode = binding ? binding.network : uiSourceCode; |
if (this._currentFile === uiSourceCode) |
return; |
@@ -234,7 +259,7 @@ WebInspector.TabbedEditorContainer.prototype = { |
{ |
var maxDisplayNameLength = 30; |
var title = uiSourceCode.displayName(true).trimMiddle(maxDisplayNameLength); |
- if (uiSourceCode.isDirty() || uiSourceCode.hasUnsavedCommittedChanges()) |
+ if (uiSourceCode.isDirty() || WebInspector.persistence.hasUnsavedCommittedChanges(uiSourceCode)) |
title += "*"; |
return title; |
}, |
@@ -482,7 +507,7 @@ WebInspector.TabbedEditorContainer.prototype = { |
if (tabId) { |
var title = this._titleForFile(uiSourceCode); |
this._tabbedPane.changeTabTitle(tabId, title); |
- if (uiSourceCode.hasUnsavedCommittedChanges()) |
+ if (WebInspector.persistence.hasUnsavedCommittedChanges(uiSourceCode)) |
this._tabbedPane.setTabIcon(tabId, "warning-icon", WebInspector.UIString("Changes to this file were not saved to file system.")); |
else |
this._tabbedPane.setTabIcon(tabId, ""); |