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

Unified Diff: WebCore/inspector/front-end/Resource.js

Issue 5446003: Merge 72938 - 2010-11-30 Pavel Feldman <pfeldman@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 10 years, 1 month 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 | « WebCore/inspector/front-end/CSSStyleModel.js ('k') | WebCore/inspector/front-end/ResourcesPanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/inspector/front-end/Resource.js
===================================================================
--- WebCore/inspector/front-end/Resource.js (revision 73033)
+++ WebCore/inspector/front-end/Resource.js (working copy)
@@ -625,22 +625,69 @@
return this._content;
},
- set content(content)
+ get contentTimestamp()
{
- var data = { oldContent: this._content, oldContentTimestamp: this._contentTimestamp };
+ return this._contentTimestamp;
+ },
+
+ setInitialContent: function(content)
+ {
this._content = content;
- this._contentTimestamp = new Date();
+ },
+
+ isLocallyModified: function()
+ {
+ return !!this._baseRevision;
+ },
+
+ setContent: function(newContent, onRevert)
+ {
+ var revisionResource = new WebInspector.Resource(null, this.url);
+ revisionResource.type = this.type;
+ revisionResource.loader = this.loader;
+ revisionResource.timestamp = this.timestamp;
+ revisionResource._content = this._content;
+ revisionResource._actualResource = this;
+ revisionResource._fireOnRevert = onRevert;
+
+ if (this.finished)
+ revisionResource.finished = true;
+ else {
+ function finished()
+ {
+ this.removeEventListener("finished", finished);
+ revisionResource.finished = true;
+ }
+ this.addEventListener("finished", finished.bind(this));
+ }
+
+ if (!this._baseRevision)
+ this._baseRevision = revisionResource;
+ else
+ revisionResource._baseRevision = this._baseRevision;
+
+ var data = { revision: revisionResource };
+ this._content = newContent;
+ this.timestamp = new Date();
this.dispatchEventToListeners("content-changed", data);
},
- get contentTimestamp()
+ revertToThis: function()
{
- return this._contentTimestamp;
+ if (!this._actualResource || !this._fireOnRevert)
+ return;
+
+ function callback(content)
+ {
+ if (content)
+ this._fireOnRevert(content);
+ }
+ this.requestContent(callback.bind(this));
},
- setInitialContent: function(content)
+ get baseRevision()
{
- this._content = content;
+ return this._baseRevision;
},
requestContent: function(callback)
« no previous file with comments | « WebCore/inspector/front-end/CSSStyleModel.js ('k') | WebCore/inspector/front-end/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698