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

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 2694923002: DevTools: Changes Drawer (Closed)
Patch Set: Remove event listener on willHide Created 3 years, 9 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/ui/TextEditor.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/workspace/UISourceCode.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
index 4fa5b554791586c37976b94c5f63d1532deb9929..1fe1bb5d05d80bf1ebfb7e97769099ac26be3f18 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -75,6 +75,7 @@ Workspace.UISourceCode = class extends Common.Object {
this._workingCopy = null;
/** @type {?function() : string} */
this._workingCopyGetter = null;
+ this._mightHaveChanges = false;
}
/**
@@ -318,6 +319,7 @@ Workspace.UISourceCode = class extends Common.Object {
if (!lastRevision || lastRevision._content !== this._content) {
var revision = new Workspace.Revision(this, this._content, new Date());
this._history.push(revision);
+ this.mightHaveChanges = true;
}
this._innerResetWorkingCopy();
@@ -331,6 +333,15 @@ Workspace.UISourceCode = class extends Common.Object {
}
}
+ /**
+ * @return {!Promise<boolean>}
+ */
+ hasChanges() {
+ if (!this.mightHaveChanges)
+ return Promise.resolve(false);
+ return this.requestOriginalContent().then(content => this.mightHaveChanges = content !== this.workingCopy());
+ }
+
saveAs() {
Workspace.fileManager.save(this._url, this.workingCopy(), true, callback.bind(this));
Workspace.fileManager.close(this._url);
@@ -442,6 +453,7 @@ Workspace.UISourceCode = class extends Common.Object {
}
_workingCopyChanged() {
+ this.mightHaveChanges = true;
this._removeAllMessages();
this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChanged, this);
this._project.workspace().dispatchEventToListeners(
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/TextEditor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698