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

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

Issue 1564113003: DevTools: merge uisourcecode's url-alike members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 11 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 da052281a8585c3af3a3c0a70cc90963f7b86575..7df791de3bb6053a969b25da673e6d7002858667 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -40,12 +40,11 @@
WebInspector.UISourceCode = function(project, url, contentType)
{
this._project = project;
- this._path = url;
- this._originURL = url;
+ this._url = url;
var pathComponents = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
- this._host = pathComponents[0];
- this._parentPath = pathComponents.slice(0, -1).join("/");
+ this._origin = pathComponents[0];
+ this._parentURL = pathComponents.slice(0, -1).join("/");
this._name = pathComponents[pathComponents.length - 1];
this._contentType = contentType;
@@ -76,33 +75,33 @@ WebInspector.UISourceCode.prototype = {
/**
* @return {string}
*/
- path: function()
+ name: function()
{
- return this._path;
+ return this._name;
},
/**
* @return {string}
*/
- name: function()
+ url: function()
{
- return this._name;
+ return this._url;
},
/**
* @return {string}
*/
- parentPath: function()
+ parentURL: function()
{
- return this._parentPath;
+ return this._parentURL;
},
/**
* @return {string}
*/
- host: function()
+ origin: function()
{
- return this._host;
+ return this._origin;
},
/**
@@ -110,7 +109,7 @@ WebInspector.UISourceCode.prototype = {
*/
fullDisplayName: function()
{
- return this._parentPath.replace(/^(?:https?|file)\:\/\//, "") + "/" + this.displayName(true);
+ return this._parentURL.replace(/^(?:https?|file)\:\/\//, "") + "/" + this.displayName(true);
},
/**
@@ -124,22 +123,6 @@ WebInspector.UISourceCode.prototype = {
},
/**
- * @return {string}
- */
- uri: function()
- {
- return this._path;
- },
-
- /**
- * @return {string}
- */
- originURL: function()
- {
- return this._originURL;
- },
-
- /**
* @return {boolean}
*/
isFromServiceProject: function()
@@ -166,38 +149,38 @@ WebInspector.UISourceCode.prototype = {
/**
* @param {boolean} success
* @param {string=} newName
- * @param {string=} newOriginURL
+ * @param {string=} newURL
* @param {!WebInspector.ResourceType=} newContentType
* @this {WebInspector.UISourceCode}
*/
- function innerCallback(success, newName, newOriginURL, newContentType)
+ function innerCallback(success, newName, newURL, newContentType)
{
if (success)
- this._updateName(/** @type {string} */ (newName), /** @type {string} */ (newOriginURL), /** @type {!WebInspector.ResourceType} */ (newContentType));
+ this._updateName(/** @type {string} */ (newName), /** @type {string} */ (newURL), /** @type {!WebInspector.ResourceType} */ (newContentType));
callback(success);
}
},
remove: function()
{
- this._project.deleteFile(this.path());
+ this._project.deleteFile(this.url());
},
/**
* @param {string} name
- * @param {string} originURL
+ * @param {string} url
* @param {!WebInspector.ResourceType=} contentType
*/
- _updateName: function(name, originURL, contentType)
+ _updateName: function(name, url, contentType)
{
- var oldURI = this.uri();
- this._path = this._path.substring(0, this._path.length - this._name.length) + name;
+ var oldURĐ” = this.url();
+ this._url = this._url.substring(0, this._url.length - this._name.length) + name;
this._name = name;
- if (originURL)
- this._originURL = originURL;
+ if (url)
+ this._url = url;
if (contentType)
this._contentType = contentType;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, oldURI);
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, oldURĐ”);
},
/**
@@ -206,7 +189,7 @@ WebInspector.UISourceCode.prototype = {
*/
contentURL: function()
{
- return this.originURL();
+ return this.url();
},
/**
@@ -356,9 +339,9 @@ WebInspector.UISourceCode.prototype = {
wasPersisted = true;
} else if (this._project.workspace().hasResourceContentTrackingExtensions()) {
wasPersisted = true;
- } else if (this._originURL && WebInspector.fileManager.isURLSaved(this._originURL)) {
- WebInspector.fileManager.save(this._originURL, content, false, function() { });
- WebInspector.fileManager.close(this._originURL);
+ } else if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
+ WebInspector.fileManager.save(this._url, content, false, function() { });
+ WebInspector.fileManager.close(this._url);
wasPersisted = true;
}
this._contentCommitted(content, wasPersisted, true);
@@ -391,8 +374,8 @@ WebInspector.UISourceCode.prototype = {
saveAs: function()
{
- WebInspector.fileManager.save(this._originURL, this.workingCopy(), true, callback.bind(this));
- WebInspector.fileManager.close(this._originURL);
+ WebInspector.fileManager.save(this._url, this.workingCopy(), true, callback.bind(this));
+ WebInspector.fileManager.close(this._url);
/**
* @param {boolean} accepted
@@ -680,7 +663,7 @@ WebInspector.UILocation.prototype = {
*/
id: function()
{
- return this.uiSourceCode.project().id() + ":" + this.uiSourceCode.uri() + ":" + this.lineNumber + ":" + this.columnNumber;
+ return this.uiSourceCode.project().id() + ":" + this.uiSourceCode.url() + ":" + this.lineNumber + ":" + this.columnNumber;
},
/**
@@ -688,7 +671,7 @@ WebInspector.UILocation.prototype = {
*/
toUIString: function()
{
- return this.uiSourceCode.uri() + ":" + (this.lineNumber + 1);
+ return this.uiSourceCode.url() + ":" + (this.lineNumber + 1);
}
}
@@ -752,7 +735,7 @@ WebInspector.Revision.prototype = {
*/
contentURL: function()
{
- return this._uiSourceCode.originURL();
+ return this._uiSourceCode.url();
},
/**

Powered by Google App Engine
This is Rietveld 408576698