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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 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
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 466760c4472fb45a9438172a56c7032edbd560ae..fff83b1dbd5d7b5996a6295f93f7bbae49450319 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -28,14 +28,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
- * @implements {WebInspector.ContentProvider}
+ * @implements {Common.ContentProvider}
* @unrestricted
*/
-WebInspector.UISourceCode = class extends WebInspector.Object {
+Workspace.UISourceCode = class extends Common.Object {
/**
- * @param {!WebInspector.Project} project
+ * @param {!Workspace.Project} project
* @param {string} url
- * @param {!WebInspector.ResourceType} contentType
+ * @param {!Common.ResourceType} contentType
*/
constructor(project, url, contentType) {
super();
@@ -60,18 +60,18 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
this._requestContentCallback = null;
/** @type {?Promise<?string>} */
this._requestContentPromise = null;
- /** @type {!Map<string, !Map<number, !WebInspector.UISourceCode.LineMarker>>} */
+ /** @type {!Map<string, !Map<number, !Workspace.UISourceCode.LineMarker>>} */
this._lineDecorations = new Map();
- /** @type {!Array.<!WebInspector.Revision>} */
+ /** @type {!Array.<!Workspace.Revision>} */
this.history = [];
- /** @type {!Array<!WebInspector.UISourceCode.Message>} */
+ /** @type {!Array<!Workspace.UISourceCode.Message>} */
this._messages = [];
}
/**
- * @return {!Promise<?WebInspector.UISourceCodeMetadata>}
+ * @return {!Promise<?Workspace.UISourceCodeMetadata>}
*/
requestMetadata() {
return this._project.requestMetadata(this);
@@ -123,7 +123,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
*/
displayName(skipTrim) {
if (!this._name)
- return WebInspector.UIString('(index)');
+ return Common.UIString('(index)');
var name = this._name;
try {
name = decodeURI(name);
@@ -136,7 +136,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
* @return {boolean}
*/
isFromServiceProject() {
- return WebInspector.Project.isServiceProject(this._project);
+ return Workspace.Project.isServiceProject(this._project);
}
/**
@@ -157,14 +157,14 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
* @param {boolean} success
* @param {string=} newName
* @param {string=} newURL
- * @param {!WebInspector.ResourceType=} newContentType
- * @this {WebInspector.UISourceCode}
+ * @param {!Common.ResourceType=} newContentType
+ * @this {Workspace.UISourceCode}
*/
function innerCallback(success, newName, newURL, newContentType) {
if (success)
this._updateName(
/** @type {string} */ (newName), /** @type {string} */ (newURL),
- /** @type {!WebInspector.ResourceType} */ (newContentType));
+ /** @type {!Common.ResourceType} */ (newContentType));
callback(success);
}
}
@@ -176,7 +176,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
/**
* @param {string} name
* @param {string} url
- * @param {!WebInspector.ResourceType=} contentType
+ * @param {!Common.ResourceType=} contentType
*/
_updateName(name, url, contentType) {
var oldURL = this.url();
@@ -186,7 +186,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
this._url = url;
if (contentType)
this._contentType = contentType;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, oldURL);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.TitleChanged, oldURL);
}
/**
@@ -199,14 +199,14 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
/**
* @override
- * @return {!WebInspector.ResourceType}
+ * @return {!Common.ResourceType}
*/
contentType() {
return this._contentType;
}
/**
- * @return {!WebInspector.Project}
+ * @return {!Workspace.Project}
*/
project() {
return this._project;
@@ -273,7 +273,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
/**
* @param {?string} updatedContent
- * @this {WebInspector.UISourceCode}
+ * @this {Workspace.UISourceCode}
*/
function contentLoaded(updatedContent) {
if (updatedContent === null) {
@@ -301,7 +301,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
}
var shouldUpdate =
- window.confirm(WebInspector.UIString('This file was changed externally. Would you like to reload it?'));
+ window.confirm(Common.UIString('This file was changed externally. Would you like to reload it?'));
if (shouldUpdate)
this._contentCommitted(updatedContent, false);
else
@@ -330,9 +330,9 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
_commitContent(content) {
if (this._project.canSetFileContent()) {
this._project.setFileContent(this, content, function() {});
- } else if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
- WebInspector.fileManager.save(this._url, content, false, function() {});
- WebInspector.fileManager.close(this._url);
+ } else if (this._url && Workspace.fileManager.isURLSaved(this._url)) {
+ Workspace.fileManager.save(this._url, content, false, function() {});
+ Workspace.fileManager.close(this._url);
}
this._contentCommitted(content, true);
}
@@ -348,26 +348,26 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
var lastRevision = this.history.length ? this.history[this.history.length - 1] : null;
if (!lastRevision || lastRevision._content !== this._content) {
- var revision = new WebInspector.Revision(this, this._content, new Date());
+ var revision = new Workspace.Revision(this, this._content, new Date());
this.history.push(revision);
}
this._innerResetWorkingCopy();
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {content: content});
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyCommitted, {content: content});
this._project.workspace().dispatchEventToListeners(
- WebInspector.Workspace.Events.WorkingCopyCommitted, {uiSourceCode: this, content: content});
+ Workspace.Workspace.Events.WorkingCopyCommitted, {uiSourceCode: this, content: content});
if (committedByUser)
this._project.workspace().dispatchEventToListeners(
- WebInspector.Workspace.Events.WorkingCopyCommittedByUser, {uiSourceCode: this, content: content});
+ Workspace.Workspace.Events.WorkingCopyCommittedByUser, {uiSourceCode: this, content: content});
}
saveAs() {
- WebInspector.fileManager.save(this._url, this.workingCopy(), true, callback.bind(this));
- WebInspector.fileManager.close(this._url);
+ Workspace.fileManager.save(this._url, this.workingCopy(), true, callback.bind(this));
+ Workspace.fileManager.close(this._url);
/**
* @param {boolean} accepted
- * @this {WebInspector.UISourceCode}
+ * @this {Workspace.UISourceCode}
*/
function callback(accepted) {
if (accepted)
@@ -387,7 +387,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
*/
revertToOriginal() {
/**
- * @this {WebInspector.UISourceCode}
+ * @this {Workspace.UISourceCode}
* @param {?string} content
*/
function callback(content) {
@@ -397,16 +397,16 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
this.addRevision(content);
}
- WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.RevisionApplied);
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.RevisionApplied);
return this.requestOriginalContent().then(callback.bind(this));
}
/**
- * @param {function(!WebInspector.UISourceCode)} callback
+ * @param {function(!Workspace.UISourceCode)} callback
*/
revertAndClearHistory(callback) {
/**
- * @this {WebInspector.UISourceCode}
+ * @this {Workspace.UISourceCode}
* @param {?string} content
*/
function revert(content) {
@@ -418,7 +418,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
callback(this);
}
- WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.RevisionApplied);
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.RevisionApplied);
this.requestOriginalContent().then(revert.bind(this));
}
@@ -437,7 +437,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
resetWorkingCopy() {
this._innerResetWorkingCopy();
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChanged);
}
_innerResetWorkingCopy() {
@@ -451,16 +451,16 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
setWorkingCopy(newWorkingCopy) {
this._workingCopy = newWorkingCopy;
delete this._workingCopyGetter;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChanged);
this._project.workspace().dispatchEventToListeners(
- WebInspector.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
+ Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
}
setWorkingCopyGetter(workingCopyGetter) {
this._workingCopyGetter = workingCopyGetter;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChanged);
this._project.workspace().dispatchEventToListeners(
- WebInspector.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
+ Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this});
}
removeWorkingCopyGetter() {
@@ -486,7 +486,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
* @return {string}
*/
extension() {
- return WebInspector.ParsedURL.extractExtension(this._name);
+ return Common.ParsedURL.extractExtension(this._name);
}
/**
@@ -501,7 +501,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
* @param {string} query
* @param {boolean} caseSensitive
* @param {boolean} isRegex
- * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
+ * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback
*/
searchInContent(query, caseSensitive, isRegex, callback) {
var content = this.content();
@@ -517,7 +517,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
* @param {string} content
*/
function doSearch(content) {
- callback(WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex));
+ callback(Common.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex));
}
}
@@ -545,59 +545,59 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
/**
* @param {number} lineNumber
* @param {number=} columnNumber
- * @return {!WebInspector.UILocation}
+ * @return {!Workspace.UILocation}
*/
uiLocation(lineNumber, columnNumber) {
if (typeof columnNumber === 'undefined')
columnNumber = 0;
- return new WebInspector.UILocation(this, lineNumber, columnNumber);
+ return new Workspace.UILocation(this, lineNumber, columnNumber);
}
/**
- * @return {!Array<!WebInspector.UISourceCode.Message>}
+ * @return {!Array<!Workspace.UISourceCode.Message>}
*/
messages() {
return this._messages.slice();
}
/**
- * @param {!WebInspector.UISourceCode.Message.Level} level
+ * @param {!Workspace.UISourceCode.Message.Level} level
* @param {string} text
* @param {number} lineNumber
* @param {number=} columnNumber
- * @return {!WebInspector.UISourceCode.Message} message
+ * @return {!Workspace.UISourceCode.Message} message
*/
addLineMessage(level, text, lineNumber, columnNumber) {
return this.addMessage(
- level, text, new WebInspector.TextRange(lineNumber, columnNumber || 0, lineNumber, columnNumber || 0));
+ level, text, new Common.TextRange(lineNumber, columnNumber || 0, lineNumber, columnNumber || 0));
}
/**
- * @param {!WebInspector.UISourceCode.Message.Level} level
+ * @param {!Workspace.UISourceCode.Message.Level} level
* @param {string} text
- * @param {!WebInspector.TextRange} range
- * @return {!WebInspector.UISourceCode.Message} message
+ * @param {!Common.TextRange} range
+ * @return {!Workspace.UISourceCode.Message} message
*/
addMessage(level, text, range) {
- var message = new WebInspector.UISourceCode.Message(this, level, text, range);
+ var message = new Workspace.UISourceCode.Message(this, level, text, range);
this._messages.push(message);
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAdded, message);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageAdded, message);
return message;
}
/**
- * @param {!WebInspector.UISourceCode.Message} message
+ * @param {!Workspace.UISourceCode.Message} message
*/
removeMessage(message) {
if (this._messages.remove(message))
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, message);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved, message);
}
removeAllMessages() {
var messages = this._messages;
this._messages = [];
for (var message of messages)
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, message);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved, message);
}
/**
@@ -611,9 +611,9 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
markers = new Map();
this._lineDecorations.set(type, markers);
}
- var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type, data);
+ var marker = new Workspace.UISourceCode.LineMarker(lineNumber, type, data);
markers.set(lineNumber, marker);
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationAdded, marker);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationAdded, marker);
}
/**
@@ -628,7 +628,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
if (!marker)
return;
markers.delete(lineNumber);
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, marker);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
if (!markers.size)
this._lineDecorations.delete(type);
}
@@ -642,13 +642,13 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
return;
this._lineDecorations.delete(type);
markers.forEach(marker => {
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, marker);
+ this.dispatchEventToListeners(Workspace.UISourceCode.Events.LineDecorationRemoved, marker);
});
}
/**
* @param {string} type
- * @return {?Map<number, !WebInspector.UISourceCode.LineMarker>}
+ * @return {?Map<number, !Workspace.UISourceCode.LineMarker>}
*/
lineDecorations(type) {
return this._lineDecorations.get(type) || null;
@@ -656,7 +656,7 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
};
/** @enum {symbol} */
-WebInspector.UISourceCode.Events = {
+Workspace.UISourceCode.Events = {
WorkingCopyChanged: Symbol('WorkingCopyChanged'),
WorkingCopyCommitted: Symbol('WorkingCopyCommitted'),
TitleChanged: Symbol('TitleChanged'),
@@ -670,9 +670,9 @@ WebInspector.UISourceCode.Events = {
/**
* @unrestricted
*/
-WebInspector.UILocation = class {
+Workspace.UILocation = class {
/**
- * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @param {!Workspace.UISourceCode} uiSourceCode
* @param {number} lineNumber
* @param {number} columnNumber
*/
@@ -708,8 +708,8 @@ WebInspector.UILocation = class {
}
/**
- * @param {!WebInspector.UILocation} location1
- * @param {!WebInspector.UILocation} location2
+ * @param {!Workspace.UILocation} location1
+ * @param {!Workspace.UILocation} location2
* @return {number}
*/
static comparator(location1, location2) {
@@ -717,7 +717,7 @@ WebInspector.UILocation = class {
}
/**
- * @param {!WebInspector.UILocation} other
+ * @param {!Workspace.UILocation} other
* @return {number}
*/
compareTo(other) {
@@ -730,12 +730,12 @@ WebInspector.UILocation = class {
};
/**
- * @implements {WebInspector.ContentProvider}
+ * @implements {Common.ContentProvider}
* @unrestricted
*/
-WebInspector.Revision = class {
+Workspace.Revision = class {
/**
- * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @param {!Workspace.UISourceCode} uiSourceCode
* @param {?string|undefined} content
* @param {!Date} timestamp
*/
@@ -746,7 +746,7 @@ WebInspector.Revision = class {
}
/**
- * @return {!WebInspector.UISourceCode}
+ * @return {!Workspace.UISourceCode}
*/
get uiSourceCode() {
return this._uiSourceCode;
@@ -772,13 +772,13 @@ WebInspector.Revision = class {
revertToThis() {
/**
* @param {?string} content
- * @this {WebInspector.Revision}
+ * @this {Workspace.Revision}
*/
function revert(content) {
if (content && this._uiSourceCode._content !== content)
this._uiSourceCode.addRevision(content);
}
- WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.RevisionApplied);
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.RevisionApplied);
return this.requestContent().then(revert.bind(this));
}
@@ -792,7 +792,7 @@ WebInspector.Revision = class {
/**
* @override
- * @return {!WebInspector.ResourceType}
+ * @return {!Common.ResourceType}
*/
contentType() {
return this._uiSourceCode.contentType();
@@ -811,7 +811,7 @@ WebInspector.Revision = class {
* @param {string} query
* @param {boolean} caseSensitive
* @param {boolean} isRegex
- * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
+ * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback
*/
searchInContent(query, caseSensitive, isRegex, callback) {
callback([]);
@@ -821,12 +821,12 @@ WebInspector.Revision = class {
/**
* @unrestricted
*/
-WebInspector.UISourceCode.Message = class {
+Workspace.UISourceCode.Message = class {
/**
- * @param {!WebInspector.UISourceCode} uiSourceCode
- * @param {!WebInspector.UISourceCode.Message.Level} level
+ * @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {!Workspace.UISourceCode.Message.Level} level
* @param {string} text
- * @param {!WebInspector.TextRange} range
+ * @param {!Common.TextRange} range
*/
constructor(uiSourceCode, level, text, range) {
this._uiSourceCode = uiSourceCode;
@@ -836,14 +836,14 @@ WebInspector.UISourceCode.Message = class {
}
/**
- * @return {!WebInspector.UISourceCode}
+ * @return {!Workspace.UISourceCode}
*/
uiSourceCode() {
return this._uiSourceCode;
}
/**
- * @return {!WebInspector.UISourceCode.Message.Level}
+ * @return {!Workspace.UISourceCode.Message.Level}
*/
level() {
return this._level;
@@ -857,7 +857,7 @@ WebInspector.UISourceCode.Message = class {
}
/**
- * @return {!WebInspector.TextRange}
+ * @return {!Common.TextRange}
*/
range() {
return this._range;
@@ -878,7 +878,7 @@ WebInspector.UISourceCode.Message = class {
}
/**
- * @param {!WebInspector.UISourceCode.Message} another
+ * @param {!Workspace.UISourceCode.Message} another
* @return {boolean}
*/
isEqual(another) {
@@ -894,7 +894,7 @@ WebInspector.UISourceCode.Message = class {
/**
* @enum {string}
*/
-WebInspector.UISourceCode.Message.Level = {
+Workspace.UISourceCode.Message.Level = {
Error: 'Error',
Warning: 'Warning'
};
@@ -902,7 +902,7 @@ WebInspector.UISourceCode.Message.Level = {
/**
* @unrestricted
*/
-WebInspector.UISourceCode.LineMarker = class {
+Workspace.UISourceCode.LineMarker = class {
/**
* @param {number} line
* @param {string} type
@@ -939,7 +939,7 @@ WebInspector.UISourceCode.LineMarker = class {
/**
* @unrestricted
*/
-WebInspector.UISourceCodeMetadata = class {
+Workspace.UISourceCodeMetadata = class {
/**
* @param {?Date} modificationTime
* @param {?number} contentSize

Powered by Google App Engine
This is Rietveld 408576698