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

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

Issue 1403373013: DevTools: move ui messages from SourceFrame to UISourceCodeFrame (step2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed 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.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
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 var messages = this._messages;
609 this._messages = [];
610 for (var message of messages)
611 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa geRemoved, message);
612 },
613
569 __proto__: WebInspector.Object.prototype 614 __proto__: WebInspector.Object.prototype
570 } 615 }
571 616
572 /** 617 /**
573 * @constructor 618 * @constructor
574 * @param {!WebInspector.UISourceCode} uiSourceCode 619 * @param {!WebInspector.UISourceCode} uiSourceCode
575 * @param {number} lineNumber 620 * @param {number} lineNumber
576 * @param {number} columnNumber 621 * @param {number} columnNumber
577 */ 622 */
578 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) 623 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 745 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
701 */ 746 */
702 searchInContent: function(query, caseSensitive, isRegex, callback) 747 searchInContent: function(query, caseSensitive, isRegex, callback)
703 { 748 {
704 callback([]); 749 callback([]);
705 } 750 }
706 } 751 }
707 752
708 /** 753 /**
709 * @constructor 754 * @constructor
755 * @param {!WebInspector.UISourceCode} uiSourceCode
710 * @param {!WebInspector.UISourceCode.Message.Level} level 756 * @param {!WebInspector.UISourceCode.Message.Level} level
711 * @param {string} text 757 * @param {string} text
712 * @param {number} lineNumber 758 * @param {number} lineNumber
713 * @param {number=} columnNumber 759 * @param {number=} columnNumber
714 */ 760 */
715 WebInspector.UISourceCode.Message = function(level, text, lineNumber, columnNumb er) 761 WebInspector.UISourceCode.Message = function(uiSourceCode, level, text, lineNumb er, columnNumber)
716 { 762 {
763 this._uiSourceCode = uiSourceCode;
764 this._level = level;
717 this._text = text; 765 this._text = text;
718 this._level = level;
719 this._lineNumber = lineNumber; 766 this._lineNumber = lineNumber;
720 this._columnNumber = columnNumber; 767 this._columnNumber = columnNumber;
721 } 768 }
722 769
723 /** 770 /**
724 * @enum {string} 771 * @enum {string}
725 */ 772 */
726 WebInspector.UISourceCode.Message.Level = { 773 WebInspector.UISourceCode.Message.Level = {
727 Error: "Error", 774 Error: "Error",
728 Warning: "Warning" 775 Warning: "Warning"
729 } 776 }
730 777
731 WebInspector.UISourceCode.Message.prototype = { 778 WebInspector.UISourceCode.Message.prototype = {
732 /** 779 /**
733 * @return {string} 780 * @return {!WebInspector.UISourceCode}
734 */ 781 */
735 text: function() 782 uiSourceCode: function()
736 { 783 {
737 return this._text; 784 return this._uiSourceCode;
738 }, 785 },
739 786
740 /** 787 /**
741 * @return {!WebInspector.UISourceCode.Message.Level} 788 * @return {!WebInspector.UISourceCode.Message.Level}
742 */ 789 */
743 level: function() 790 level: function()
744 { 791 {
745 return this._level; 792 return this._level;
746 }, 793 },
747 794
748 /** 795 /**
796 * @return {string}
797 */
798 text: function()
799 {
800 return this._text;
801 },
802
803 /**
749 * @return {number} 804 * @return {number}
750 */ 805 */
751 lineNumber: function() 806 lineNumber: function()
752 { 807 {
753 return this._lineNumber; 808 return this._lineNumber;
754 }, 809 },
755 810
756 /** 811 /**
757 * @return {(number|undefined)} 812 * @return {(number|undefined)}
758 */ 813 */
759 columnNumber: function() 814 columnNumber: function()
760 { 815 {
761 return this._columnNumber; 816 return this._columnNumber;
762 }, 817 },
763 818
764 /** 819 /**
765 * @param {!WebInspector.UISourceCode.Message} another 820 * @param {!WebInspector.UISourceCode.Message} another
766 * @return {boolean} 821 * @return {boolean}
767 */ 822 */
768 isEqual: function(another) 823 isEqual: function(another)
769 { 824 {
770 return this.text() === another.text() && this.level() === another.level( ) && this.lineNumber() === another.lineNumber() && this.columnNumber() === anoth er.columnNumber(); 825 return this._uiSourceCode === another._uiSourceCode && this.text() === a nother.text() && this.level() === another.level() && this.lineNumber() === anoth er.lineNumber() && this.columnNumber() === another.columnNumber();
826 },
827
828 remove: function()
829 {
830 this._uiSourceCode.removeMessage(this);
771 } 831 }
772 } 832 }
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