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

Side by Side 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, 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 this._parentPath = parentPath; 45 this._parentPath = parentPath;
46 this._name = name; 46 this._name = name;
47 this._originURL = originURL; 47 this._originURL = originURL;
48 this._contentType = contentType; 48 this._contentType = contentType;
49 /** @type {!Array.<function(?string)>} */ 49 /** @type {!Array.<function(?string)>} */
50 this._requestContentCallbacks = []; 50 this._requestContentCallbacks = [];
51 51
52 /** @type {!Array.<!WebInspector.Revision>} */ 52 /** @type {!Array.<!WebInspector.Revision>} */
53 this.history = []; 53 this.history = [];
54 this._hasUnsavedCommittedChanges = false; 54 this._hasUnsavedCommittedChanges = false;
55
56 /** @type {!Array<!WebInspector.UISourceCodeMessage>} */
57 this._messages = [];
55 } 58 }
56 59
57 /** 60 /**
58 * @enum {string} 61 * @enum {string}
59 */ 62 */
60 WebInspector.UISourceCode.Events = { 63 WebInspector.UISourceCode.Events = {
61 WorkingCopyChanged: "WorkingCopyChanged", 64 WorkingCopyChanged: "WorkingCopyChanged",
62 WorkingCopyCommitted: "WorkingCopyCommitted", 65 WorkingCopyCommitted: "WorkingCopyCommitted",
63 TitleChanged: "TitleChanged", 66 TitleChanged: "TitleChanged",
64 SourceMappingChanged: "SourceMappingChanged", 67 SourceMappingChanged: "SourceMappingChanged",
68 MessageAdded: "MessageAdded",
69 MessageRemoved: "MessageRemoved"
65 } 70 }
66 71
67 WebInspector.UISourceCode.prototype = { 72 WebInspector.UISourceCode.prototype = {
68 /** 73 /**
69 * @return {string} 74 * @return {string}
70 */ 75 */
71 name: function() 76 name: function()
72 { 77 {
73 return this._name; 78 return this._name;
74 }, 79 },
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 * @param {number=} columnNumber 564 * @param {number=} columnNumber
560 * @return {!WebInspector.UILocation} 565 * @return {!WebInspector.UILocation}
561 */ 566 */
562 uiLocation: function(lineNumber, columnNumber) 567 uiLocation: function(lineNumber, columnNumber)
563 { 568 {
564 if (typeof columnNumber === "undefined") 569 if (typeof columnNumber === "undefined")
565 columnNumber = 0; 570 columnNumber = 0;
566 return new WebInspector.UILocation(this, lineNumber, columnNumber); 571 return new WebInspector.UILocation(this, lineNumber, columnNumber);
567 }, 572 },
568 573
574 /**
575 * @param {string} text
576 * @param {!WebInspector.UISourceCodeMessage.Level} level
577 * @param {!WebInspector.TextRange} location
578 * @return {!WebInspector.UISourceCodeMessage}
579 */
580 addMessage: function(text, level, location)
581 {
582 var message = new WebInspector.UISourceCodeMessage(text, level, location );
583 this._messages.push(message);
584 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAd ded, message);
585 return message;
586 },
587
588 /**
589 * @param {!WebInspector.UISourceCodeMessage} message
590 */
591 removeMessage: function(message)
592 {
593 for (var i = 0; i < this._messages.length; i++) {
594 if (message === this._messages[i]) {
595 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.M essageRemoved, this._messages.splice(i, 1));
596 return;
597 }
598 }
599 },
600
601 /**
602 * @return {!Array<!WebInspector.UISourceCodeMessage>}
603 */
604 messages: function()
605 {
606 return this._messages;
607 },
608
609 clearMessages: function()
610 {
611 var messages = this._messages.slice(0);
612 this._messages.length = 0;
613 for (var i = 0; i < messages.length; i++) {
614 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa geRemoved, messages[i]);
615 }
616 },
617
569 __proto__: WebInspector.Object.prototype 618 __proto__: WebInspector.Object.prototype
570 } 619 }
571 620
572 /** 621 /**
573 * @constructor 622 * @constructor
574 * @param {!WebInspector.UISourceCode} uiSourceCode 623 * @param {!WebInspector.UISourceCode} uiSourceCode
575 * @param {number} lineNumber 624 * @param {number} lineNumber
576 * @param {number} columnNumber 625 * @param {number} columnNumber
577 */ 626 */
578 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) 627 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 * @param {string} query 746 * @param {string} query
698 * @param {boolean} caseSensitive 747 * @param {boolean} caseSensitive
699 * @param {boolean} isRegex 748 * @param {boolean} isRegex
700 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 749 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
701 */ 750 */
702 searchInContent: function(query, caseSensitive, isRegex, callback) 751 searchInContent: function(query, caseSensitive, isRegex, callback)
703 { 752 {
704 callback([]); 753 callback([]);
705 } 754 }
706 } 755 }
756
757 /**
758 * @constructor
759 * @param {string} text
760 * @param {!WebInspector.UISourceCodeMessage.Level} level
761 * @param {!WebInspector.TextRange} location
762 */
763 WebInspector.UISourceCodeMessage = function(text, level, location) {
764 this._text = text;
765 this._level = level;
766 this._location = location;
767 }
768
769 WebInspector.UISourceCodeMessage.prototype = {
770 /**
771 * @return {string}
772 */
773 text: function()
774 {
775 return this._text;
776 },
777
778 /**
779 * @return {!WebInspector.UISourceCodeMessage.Level}
780 */
781 level: function()
782 {
783 return this._level;
784 },
785
786 /**
787 * @return {!WebInspector.TextRange}
788 */
789 location: function()
790 {
791 return this._location;
792 },
793
794 /**
795 * @param {!WebInspector.UISourceCodeMessage} another
796 * @return {boolean}
797 */
798 equal: function(another) {
799 return this.level() === another.level() &&
800 this.text() === another.text() &&
801 this.location().equal(another.location());
802 }
803 }
804
805 /**
806 * @enum {string}
807 */
808 WebInspector.UISourceCodeMessage.Level = {
809 Error: "Error",
810 Warning: "Warning"
811 }
OLDNEW
« 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