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

Unified Diff: Source/devtools/front_end/UISourceCode.js

Issue 14672033: DevTools: Make snippets renaming work through SnippetsProjectDelegate. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 7 years, 7 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 | « Source/devtools/front_end/SnippetStorage.js ('k') | Source/devtools/front_end/Workspace.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/UISourceCode.js
diff --git a/Source/devtools/front_end/UISourceCode.js b/Source/devtools/front_end/UISourceCode.js
index 79c0b538dda014516baa93fb1cdec5c984515302..caa836a81b36321176722d7491f70612ddd085c6 100644
--- a/Source/devtools/front_end/UISourceCode.js
+++ b/Source/devtools/front_end/UISourceCode.js
@@ -132,16 +132,41 @@ WebInspector.UISourceCode.prototype = {
},
/**
+ * @return {boolean}
+ */
+ canRename: function()
+ {
+ return this._project.canRename();
+ },
+
+ /**
* @param {string} newName
+ * @param {function(boolean)} callback
+ */
+ rename: function(newName, callback)
+ {
+ this._project.rename(this, newName, innerCallback.bind(this));
+
+ function innerCallback(success, newName)
+ {
+ if (success)
+ this._updateName(newName);
+ callback(success);
+ }
+ },
+
+ /**
+ * @param {string} name
*/
- rename: function(newName)
+ _updateName: function(name)
{
if (!this._path.length)
return;
- this._path[this._path.length - 1] = newName;
- this._url = newName;
- this._originURL = newName;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, null);
+ var oldURI = this.uri();
+ this._path[this._path.length - 1] = name;
+ this._url = name;
+ this._originURL = name;
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, oldURI);
},
/**
« no previous file with comments | « Source/devtools/front_end/SnippetStorage.js ('k') | Source/devtools/front_end/Workspace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698