| 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 var pathComponents = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 45 var pathComponents = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 46 this._origin = pathComponents[0]; | 46 this._origin = pathComponents[0]; |
| 47 this._parentURL = pathComponents.slice(0, -1).join("/"); | 47 this._parentURL = pathComponents.slice(0, -1).join("/"); |
| 48 this._name = pathComponents[pathComponents.length - 1]; | 48 this._name = pathComponents[pathComponents.length - 1]; |
| 49 | 49 |
| 50 this._contentType = contentType; | 50 this._contentType = contentType; |
| 51 /** @type {?function(?string)} */ | 51 /** @type {?function(?string)} */ |
| 52 this._requestContentCallback = null; | 52 this._requestContentCallback = null; |
| 53 /** @type {?Promise<?string>} */ | 53 /** @type {?Promise<?string>} */ |
| 54 this._requestContentPromise = null; | 54 this._requestContentPromise = null; |
| 55 /** @type {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} */ |
| 56 this._lineDecorations = new Map(); |
| 55 | 57 |
| 56 /** @type {!Array.<!WebInspector.Revision>} */ | 58 /** @type {!Array.<!WebInspector.Revision>} */ |
| 57 this.history = []; | 59 this.history = []; |
| 58 this._hasUnsavedCommittedChanges = false; | 60 this._hasUnsavedCommittedChanges = false; |
| 59 | 61 |
| 60 /** @type {!Array<!WebInspector.UISourceCode.Message>} */ | 62 /** @type {!Array<!WebInspector.UISourceCode.Message>} */ |
| 61 this._messages = []; | 63 this._messages = []; |
| 62 } | 64 } |
| 63 | 65 |
| 64 /** | 66 /** |
| 65 * @enum {string} | 67 * @enum {string} |
| 66 */ | 68 */ |
| 67 WebInspector.UISourceCode.Events = { | 69 WebInspector.UISourceCode.Events = { |
| 68 WorkingCopyChanged: "WorkingCopyChanged", | 70 WorkingCopyChanged: "WorkingCopyChanged", |
| 69 WorkingCopyCommitted: "WorkingCopyCommitted", | 71 WorkingCopyCommitted: "WorkingCopyCommitted", |
| 70 TitleChanged: "TitleChanged", | 72 TitleChanged: "TitleChanged", |
| 71 SourceMappingChanged: "SourceMappingChanged", | 73 SourceMappingChanged: "SourceMappingChanged", |
| 72 MessageAdded: "MessageAdded", | 74 MessageAdded: "MessageAdded", |
| 73 MessageRemoved: "MessageRemoved", | 75 MessageRemoved: "MessageRemoved", |
| 76 LineDecorationAdded: "LineDecorationAdded", |
| 77 LineDecorationRemoved: "LineDecorationRemoved" |
| 74 } | 78 } |
| 75 | 79 |
| 76 WebInspector.UISourceCode.prototype = { | 80 WebInspector.UISourceCode.prototype = { |
| 77 /** | 81 /** |
| 78 * @return {string} | 82 * @return {string} |
| 79 */ | 83 */ |
| 80 name: function() | 84 name: function() |
| 81 { | 85 { |
| 82 return this._name; | 86 return this._name; |
| 83 }, | 87 }, |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 }, | 641 }, |
| 638 | 642 |
| 639 removeAllMessages: function() | 643 removeAllMessages: function() |
| 640 { | 644 { |
| 641 var messages = this._messages; | 645 var messages = this._messages; |
| 642 this._messages = []; | 646 this._messages = []; |
| 643 for (var message of messages) | 647 for (var message of messages) |
| 644 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa
geRemoved, message); | 648 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.Messa
geRemoved, message); |
| 645 }, | 649 }, |
| 646 | 650 |
| 651 /** |
| 652 * @param {number} lineNumber |
| 653 * @param {string} type |
| 654 * @param {?} data |
| 655 */ |
| 656 addLineDecoration: function(lineNumber, type, data) |
| 657 { |
| 658 var markers = this._lineDecorations.get(type); |
| 659 if (!markers) { |
| 660 markers = []; |
| 661 this._lineDecorations.set(type, markers); |
| 662 } |
| 663 var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type,
data); |
| 664 markers.push(marker); |
| 665 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecor
ationAdded, marker); |
| 666 }, |
| 667 |
| 668 /** |
| 669 * @param {string} type |
| 670 */ |
| 671 removeAllLineDecorations: function(type) |
| 672 { |
| 673 var markers = this._lineDecorations.get(type) || []; |
| 674 markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UI
SourceCode.Events.LineDecorationRemoved)); |
| 675 this._lineDecorations.delete(type); |
| 676 }, |
| 677 |
| 678 /** |
| 679 * @param {string} type |
| 680 * @return {?Array<!WebInspector.UISourceCode.LineMarker>} |
| 681 */ |
| 682 lineDecorations: function(type) |
| 683 { |
| 684 return this._lineDecorations.get(type) || null; |
| 685 }, |
| 686 |
| 647 __proto__: WebInspector.Object.prototype | 687 __proto__: WebInspector.Object.prototype |
| 648 } | 688 } |
| 649 | 689 |
| 650 /** | 690 /** |
| 651 * @constructor | 691 * @constructor |
| 652 * @param {!WebInspector.UISourceCode} uiSourceCode | 692 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 653 * @param {number} lineNumber | 693 * @param {number} lineNumber |
| 654 * @param {number} columnNumber | 694 * @param {number} columnNumber |
| 655 */ | 695 */ |
| 656 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) | 696 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 * @return {string} | 870 * @return {string} |
| 831 */ | 871 */ |
| 832 text: function() | 872 text: function() |
| 833 { | 873 { |
| 834 return this._text; | 874 return this._text; |
| 835 }, | 875 }, |
| 836 | 876 |
| 837 /** | 877 /** |
| 838 * @return {!WebInspector.TextRange} | 878 * @return {!WebInspector.TextRange} |
| 839 */ | 879 */ |
| 840 range: function() { | 880 range: function() |
| 881 { |
| 841 return this._range; | 882 return this._range; |
| 842 }, | 883 }, |
| 843 | 884 |
| 844 /** | 885 /** |
| 845 * @return {number} | 886 * @return {number} |
| 846 */ | 887 */ |
| 847 lineNumber: function() | 888 lineNumber: function() |
| 848 { | 889 { |
| 849 return this._range.startLine; | 890 return this._range.startLine; |
| 850 }, | 891 }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 864 isEqual: function(another) | 905 isEqual: function(another) |
| 865 { | 906 { |
| 866 return this._uiSourceCode === another._uiSourceCode && this.text() === a
nother.text() && this.level() === another.level() && this.range().equal(another.
range()); | 907 return this._uiSourceCode === another._uiSourceCode && this.text() === a
nother.text() && this.level() === another.level() && this.range().equal(another.
range()); |
| 867 }, | 908 }, |
| 868 | 909 |
| 869 remove: function() | 910 remove: function() |
| 870 { | 911 { |
| 871 this._uiSourceCode.removeMessage(this); | 912 this._uiSourceCode.removeMessage(this); |
| 872 } | 913 } |
| 873 } | 914 } |
| 915 |
| 916 /** |
| 917 * @constructor |
| 918 * @param {number} line |
| 919 * @param {string} type |
| 920 * @param {?} data |
| 921 */ |
| 922 WebInspector.UISourceCode.LineMarker = function(line, type, data) |
| 923 { |
| 924 this._line = line; |
| 925 this._type = type; |
| 926 this._data = data; |
| 927 } |
| 928 |
| 929 WebInspector.UISourceCode.LineMarker.prototype = { |
| 930 /** |
| 931 * @return {number} |
| 932 */ |
| 933 line: function() |
| 934 { |
| 935 return this._line; |
| 936 }, |
| 937 |
| 938 /** |
| 939 * @return {string} |
| 940 */ |
| 941 type: function() |
| 942 { |
| 943 return this._type; |
| 944 }, |
| 945 |
| 946 /** |
| 947 * @return {*} |
| 948 */ |
| 949 data: function() |
| 950 { |
| 951 return this._data; |
| 952 } |
| 953 } |
| OLD | NEW |