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

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: event-based design 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
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 LineMessageAdded: "LineMessageAdded",
pfeldman 2015/10/27 17:37:34 These are not exactly line messages, MessageAdded?
wes 2015/10/27 21:59:16 MessageAdded is more succinct, so if its meaning i
69 LineMessageRemoved: "LineMessageRemoved"
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 {!WebInspector.UISourceCodeMessage} message
576 */
577 addLineMessage: function(message) {
pfeldman 2015/10/27 17:37:34 addLineMessage: function(level, text, location) {
wes 2015/10/27 21:59:16 Seems fine.
578 for (var i = 0; i < this._messages.length; i++) {
579 var m = this._messages[i];
580 if (m.equal(message)) {
pfeldman 2015/10/27 17:44:04 There is no reason to dedupe them here.
wes 2015/10/27 21:59:16 Alright - we do still dedupe them in the display p
581 return;
582 }
583 }
584 this._messages.push(message);
585 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineMessa geAdded, message);
586 },
587
588 /**
589 * @param {!WebInspector.UISourceCodeMessage} message
590 */
591 removeLineMessage: function(message) {
pfeldman 2015/10/27 17:37:34 Should we remove messages by identity objects?
wes 2015/10/27 21:59:16 If we don't dedupe them on entry, then we should p
592 for (var i = 0; i < this._messages.length; i++) {
593 var m = this._messages[i];
594 if (m.equal(message)) {
595 this._messages.splice(i, 1);
596 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.L ineMessageRemoved, message);
597 break;
598 }
599 }
600 },
601
569 __proto__: WebInspector.Object.prototype 602 __proto__: WebInspector.Object.prototype
pfeldman 2015/10/27 17:37:34 messages() accessor and clearMessages() would come
wes 2015/10/27 21:59:16 For sure. clearMessages() is going to fire many me
570 } 603 }
571 604
572 /** 605 /**
573 * @constructor 606 * @constructor
574 * @param {!WebInspector.UISourceCode} uiSourceCode 607 * @param {!WebInspector.UISourceCode} uiSourceCode
575 * @param {number} lineNumber 608 * @param {number} lineNumber
576 * @param {number} columnNumber 609 * @param {number} columnNumber
577 */ 610 */
578 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) 611 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber)
579 { 612 {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 * @param {string} query 730 * @param {string} query
698 * @param {boolean} caseSensitive 731 * @param {boolean} caseSensitive
699 * @param {boolean} isRegex 732 * @param {boolean} isRegex
700 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 733 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
701 */ 734 */
702 searchInContent: function(query, caseSensitive, isRegex, callback) 735 searchInContent: function(query, caseSensitive, isRegex, callback)
703 { 736 {
704 callback([]); 737 callback([]);
705 } 738 }
706 } 739 }
740
741 /**
742 * @constructor
743 * @param {string} text
744 * @param {string} kind
745 * @param {!WebInspector.TextRange} location
746 */
747 WebInspector.UISourceCodeMessage = function(text, kind, location) {
748 this._text = text;
749 this._kind = kind;
750 this._location = location;
751 }
752
753 WebInspector.UISourceCodeMessage.prototype = {
754 /**
755 * @return {string}
756 */
757 text: function()
758 {
759 return this._text;
760 },
761
762 /**
763 * @return {string}
764 */
765 kind: function()
766 {
767 return this._kind;
768 },
769
770 /**
771 * @return {!WebInspector.TextRange}
772 */
773 location: function()
774 {
775 return this._location;
776 },
777
778 /**
779 * @param {!WebInspector.UISourceCodeMessage} another
780 * @return {boolean}
781 */
782 equal: function(another) {
783 return this.kind() === another.kind() &&
784 this.text() === another.text() &&
785 this.location().equal(another.location());
786 }
787 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698