OLD | NEW |
---|---|
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 Loading... | |
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.UISourceCode.Message>} */ | |
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 Loading... | |
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 * @return {!Array<!WebInspector.UISourceCode.Message>} | |
576 */ | |
577 messages: function() | |
578 { | |
579 return this._messages.slice(); | |
580 }, | |
581 | |
582 /** | |
583 * @param {!WebInspector.UISourceCode.Message.Level} level | |
584 * @param {string} text | |
585 * @param {number} lineNumber | |
586 * @param {number=} columnNumber | |
587 * @return {!WebInspector.UISourceCode.Message} message | |
588 */ | |
589 addMessage: function(level, text, lineNumber, columnNumber) | |
590 { | |
591 var message = new WebInspector.UISourceCode.Message(this, level, text, l ineNumber, columnNumber); | |
592 this._messages.push(message); | |
593 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageAd ded, message); | |
594 return message; | |
595 }, | |
596 | |
597 /** | |
598 * @param {!WebInspector.UISourceCode.Message} message | |
599 */ | |
600 removeMessage: function(message) | |
601 { | |
602 if (this._messages.remove(message)) | |
603 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa geRemoved, message); | |
604 }, | |
605 | |
606 removeAllMessages: function() | |
607 { | |
608 for (var message of this._messages) | |
609 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa geRemoved, message); | |
dgozman
2015/10/27 21:43:49
For consistency, |message| should be removed from
pfeldman
2015/10/27 22:35:17
Done.
| |
610 this._messages = []; | |
611 }, | |
612 | |
569 __proto__: WebInspector.Object.prototype | 613 __proto__: WebInspector.Object.prototype |
570 } | 614 } |
571 | 615 |
572 /** | 616 /** |
573 * @constructor | 617 * @constructor |
574 * @param {!WebInspector.UISourceCode} uiSourceCode | 618 * @param {!WebInspector.UISourceCode} uiSourceCode |
575 * @param {number} lineNumber | 619 * @param {number} lineNumber |
576 * @param {number} columnNumber | 620 * @param {number} columnNumber |
577 */ | 621 */ |
578 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) | 622 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback | 744 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback |
701 */ | 745 */ |
702 searchInContent: function(query, caseSensitive, isRegex, callback) | 746 searchInContent: function(query, caseSensitive, isRegex, callback) |
703 { | 747 { |
704 callback([]); | 748 callback([]); |
705 } | 749 } |
706 } | 750 } |
707 | 751 |
708 /** | 752 /** |
709 * @constructor | 753 * @constructor |
754 * @param {!WebInspector.UISourceCode} uiSourceCode | |
710 * @param {!WebInspector.UISourceCode.Message.Level} level | 755 * @param {!WebInspector.UISourceCode.Message.Level} level |
711 * @param {string} text | 756 * @param {string} text |
712 * @param {number} lineNumber | 757 * @param {number} lineNumber |
713 * @param {number=} columnNumber | 758 * @param {number=} columnNumber |
714 */ | 759 */ |
715 WebInspector.UISourceCode.Message = function(level, text, lineNumber, columnNumb er) | 760 WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, lineNumb er, columnNumber) |
716 { | 761 { |
762 this._uiSourceCode = uiSourceCode; | |
763 this._level = level; | |
717 this._text = text; | 764 this._text = text; |
718 this._level = level; | |
719 this._lineNumber = lineNumber; | 765 this._lineNumber = lineNumber; |
720 this._columnNumber = columnNumber; | 766 this._columnNumber = columnNumber; |
721 } | 767 } |
722 | 768 |
723 /** | 769 /** |
724 * @enum {string} | 770 * @enum {string} |
725 */ | 771 */ |
726 WebInspector.UISourceCode.Message.Level = { | 772 WebInspector.UISourceCode.Message.Level = { |
727 Error: "Error", | 773 Error: "Error", |
728 Warning: "Warning" | 774 Warning: "Warning" |
729 } | 775 } |
730 | 776 |
731 WebInspector.UISourceCode.Message.prototype = { | 777 WebInspector.UISourceCode.Message.prototype = { |
732 /** | 778 /** |
733 * @return {string} | 779 * @return {!WebInspector.UISourceCode} |
734 */ | 780 */ |
735 text: function() | 781 uiSourceCode: function() |
736 { | 782 { |
737 return this._text; | 783 return this._uiSourceCode; |
738 }, | 784 }, |
739 | 785 |
740 /** | 786 /** |
741 * @return {!WebInspector.UISourceCode.Message.Level} | 787 * @return {!WebInspector.UISourceCode.Message.Level} |
742 */ | 788 */ |
743 level: function() | 789 level: function() |
744 { | 790 { |
745 return this._level; | 791 return this._level; |
746 }, | 792 }, |
747 | 793 |
748 /** | 794 /** |
795 * @return {string} | |
796 */ | |
797 text: function() | |
798 { | |
799 return this._text; | |
800 }, | |
801 | |
802 /** | |
749 * @return {number} | 803 * @return {number} |
750 */ | 804 */ |
751 lineNumber: function() | 805 lineNumber: function() |
752 { | 806 { |
753 return this._lineNumber; | 807 return this._lineNumber; |
754 }, | 808 }, |
755 | 809 |
756 /** | 810 /** |
757 * @return {(number|undefined)} | 811 * @return {(number|undefined)} |
758 */ | 812 */ |
759 columnNumber: function() | 813 columnNumber: function() |
760 { | 814 { |
761 return this._columnNumber; | 815 return this._columnNumber; |
762 }, | 816 }, |
763 | 817 |
764 /** | 818 /** |
765 * @param {!WebInspector.UISourceCode.Message} another | 819 * @param {!WebInspector.UISourceCode.Message} another |
766 * @return {boolean} | 820 * @return {boolean} |
767 */ | 821 */ |
768 isEqual: function(another) | 822 isEqual: function(another) |
769 { | 823 { |
770 return this.text() === another.text() && this.level() === another.level( ) && this.lineNumber() === another.lineNumber() && this.columnNumber() === anoth er.columnNumber(); | 824 return this._uiSourceCode === another._uiSourceCode && this.text() === a nother.text() && this.level() === another.level() && this.lineNumber() === anoth er.lineNumber() && this.columnNumber() === another.columnNumber(); |
825 }, | |
826 | |
827 remove: function() | |
828 { | |
829 this._uiSourceCode.removeMessage(this); | |
771 } | 830 } |
772 } | 831 } |
OLD | NEW |