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

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

Issue 2694923002: DevTools: Changes Drawer (Closed)
Patch Set: slightly better Created 3 years, 10 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/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 cf37c6908f6b4a280c0fc50018b39e95c141d596..303a7a0301676d79b9a1608297cd67971c59233a 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(

Powered by Google App Engine
This is Rietveld 408576698