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

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

Issue 1416793005: Devtools: API To set the red/yellow squiggles for a file via DI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update API with feedback from cl Created 5 years, 2 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 | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b712caec39202e087977898903fd4721db843ef4..8d08a26da203301e2973c23ecd1b81a2b5fffd11 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -52,6 +52,9 @@ WebInspector.UISourceCode = function(project, parentPath, name, originURL, conte
/** @type {!Array.<!WebInspector.Revision>} */
this.history = [];
this._hasUnsavedCommittedChanges = false;
+
+ /** @type {!Array<!WebInspector.UISourceCodeMessage>} */
+ this._messages = [];
}
/**
@@ -62,6 +65,8 @@ WebInspector.UISourceCode.Events = {
WorkingCopyCommitted: "WorkingCopyCommitted",
TitleChanged: "TitleChanged",
SourceMappingChanged: "SourceMappingChanged",
+ MessageAdded: "MessageAdded",
+ MessageRemoved: "MessageRemoved"
}
WebInspector.UISourceCode.prototype = {
@@ -566,6 +571,50 @@ WebInspector.UISourceCode.prototype = {
return new WebInspector.UILocation(this, lineNumber, columnNumber);
},
+ /**
+ * @param {string} text
+ * @param {!WebInspector.UISourceCodeMessage.Level} level
+ * @param {!WebInspector.TextRange} location
+ * @return {!WebInspector.UISourceCodeMessage}
+ */
+ addMessage: function(text, level, location)
+ {
+ var message = new WebInspector.UISourceCodeMessage(text, level, location);
+ this._messages.push(message);
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAdded, message);
+ return message;
+ },
+
+ /**
+ * @param {!WebInspector.UISourceCodeMessage} message
+ */
+ removeMessage: function(message)
+ {
+ for (var i = 0; i < this._messages.length; i++) {
+ if (message === this._messages[i]) {
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, this._messages.splice(i, 1));
+ return;
+ }
+ }
+ },
+
+ /**
+ * @return {!Array<!WebInspector.UISourceCodeMessage>}
+ */
+ messages: function()
+ {
+ return this._messages;
+ },
+
+ clearMessages: function()
+ {
+ var messages = this._messages.slice(0);
+ this._messages.length = 0;
+ for (var i = 0; i < messages.length; i++) {
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, messages[i]);
+ }
+ },
+
__proto__: WebInspector.Object.prototype
}
@@ -704,3 +753,59 @@ WebInspector.Revision.prototype = {
callback([]);
}
}
+
+/**
+ * @constructor
+ * @param {string} text
+ * @param {!WebInspector.UISourceCodeMessage.Level} level
+ * @param {!WebInspector.TextRange} location
+ */
+WebInspector.UISourceCodeMessage = function(text, level, location) {
+ this._text = text;
+ this._level = level;
+ this._location = location;
+}
+
+WebInspector.UISourceCodeMessage.prototype = {
+ /**
+ * @return {string}
+ */
+ text: function()
+ {
+ return this._text;
+ },
+
+ /**
+ * @return {!WebInspector.UISourceCodeMessage.Level}
+ */
+ level: function()
+ {
+ return this._level;
+ },
+
+ /**
+ * @return {!WebInspector.TextRange}
+ */
+ location: function()
+ {
+ return this._location;
+ },
+
+ /**
+ * @param {!WebInspector.UISourceCodeMessage} another
+ * @return {boolean}
+ */
+ equal: function(another) {
+ return this.level() === another.level() &&
+ this.text() === another.text() &&
+ this.location().equal(another.location());
+ }
+}
+
+/**
+ * @enum {string}
+ */
+WebInspector.UISourceCodeMessage.Level = {
+ Error: "Error",
+ Warning: "Warning"
+}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698