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

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

Issue 2780933003: DevTools: support UISourceCode rename in automapping (Closed)
Patch Set: fix test 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
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 7e5a368bcf4f6a9acc111d9d8c287ca3886230c0..50924e38cdeb0c305dac25933988a5d4adedcf32 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -143,10 +143,13 @@ Workspace.UISourceCode = class extends Common.Object {
/**
* @param {string} newName
- * @param {function(boolean)} callback
+ * @return {!Promise<boolean>}
*/
- rename(newName, callback) {
+ rename(newName) {
+ var fulfill;
+ var promise = new Promise(x => fulfill = x);
this._project.rename(this, newName, innerCallback.bind(this));
+ return promise;
/**
* @param {boolean} success
@@ -161,7 +164,7 @@ Workspace.UISourceCode = class extends Common.Object {
/** @type {string} */ (newName), /** @type {string} */ (newURL),
/** @type {!Common.ResourceType} */ (newContentType));
}
- callback(success);
+ fulfill(success);
}
}
@@ -175,6 +178,7 @@ Workspace.UISourceCode = class extends Common.Object {
* @param {!Common.ResourceType=} contentType
*/
_updateName(name, url, contentType) {
+ var oldURL = this._url;
this._url = this._url.substring(0, this._url.length - this._name.length) + name;
this._name = name;
if (url)
@@ -182,6 +186,8 @@ Workspace.UISourceCode = class extends Common.Object {
if (contentType)
this._contentType = contentType;
this.dispatchEventToListeners(Workspace.UISourceCode.Events.TitleChanged, this);
+ this.project().workspace().dispatchEventToListeners(
+ Workspace.Workspace.Events.UISourceCodeRenamed, {oldURL: oldURL, uiSourceCode: this});
}
/**

Powered by Google App Engine
This is Rietveld 408576698