| 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._lineMarkers = 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 LineMarkerAdded: "LineMarkerAdded", |
| 77 LineMarkerRemoved: "LineMarkerRemoved" |
| 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 addLineMarker: function(lineNumber, type, data) |
| 657 { |
| 658 var markers = this._lineMarkers.get(type); |
| 659 if (!markers) { |
| 660 markers = []; |
| 661 this._lineMarkers.set(type, markers); |
| 662 } |
| 663 var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type,
data); |
| 664 markers.push(marker); |
| 665 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineMarke
rAdded, marker); |
| 666 }, |
| 667 |
| 668 /** |
| 669 * @param {string} type |
| 670 */ |
| 671 removeAllLineMarkers: function(type) |
| 672 { |
| 673 var markers = this._lineMarkers.get(type) || []; |
| 674 markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UI
SourceCode.Events.LineMarkerRemoved)); |
| 675 this._lineMarkers.delete(type); |
| 676 }, |
| 677 |
| 678 /** |
| 679 * @return {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} |
| 680 */ |
| 681 lineMarkers: function() |
| 682 { |
| 683 return this._lineMarkers; |
| 684 }, |
| 685 |
| 647 __proto__: WebInspector.Object.prototype | 686 __proto__: WebInspector.Object.prototype |
| 648 } | 687 } |
| 649 | 688 |
| 650 /** | 689 /** |
| 651 * @constructor | 690 * @constructor |
| 652 * @param {!WebInspector.UISourceCode} uiSourceCode | 691 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 653 * @param {number} lineNumber | 692 * @param {number} lineNumber |
| 654 * @param {number} columnNumber | 693 * @param {number} columnNumber |
| 655 */ | 694 */ |
| 656 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) | 695 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 * @return {string} | 869 * @return {string} |
| 831 */ | 870 */ |
| 832 text: function() | 871 text: function() |
| 833 { | 872 { |
| 834 return this._text; | 873 return this._text; |
| 835 }, | 874 }, |
| 836 | 875 |
| 837 /** | 876 /** |
| 838 * @return {!WebInspector.TextRange} | 877 * @return {!WebInspector.TextRange} |
| 839 */ | 878 */ |
| 840 range: function() { | 879 range: function() |
| 880 { |
| 841 return this._range; | 881 return this._range; |
| 842 }, | 882 }, |
| 843 | 883 |
| 844 /** | 884 /** |
| 845 * @return {number} | 885 * @return {number} |
| 846 */ | 886 */ |
| 847 lineNumber: function() | 887 lineNumber: function() |
| 848 { | 888 { |
| 849 return this._range.startLine; | 889 return this._range.startLine; |
| 850 }, | 890 }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 864 isEqual: function(another) | 904 isEqual: function(another) |
| 865 { | 905 { |
| 866 return this._uiSourceCode === another._uiSourceCode && this.text() === a
nother.text() && this.level() === another.level() && this.range().equal(another.
range()); | 906 return this._uiSourceCode === another._uiSourceCode && this.text() === a
nother.text() && this.level() === another.level() && this.range().equal(another.
range()); |
| 867 }, | 907 }, |
| 868 | 908 |
| 869 remove: function() | 909 remove: function() |
| 870 { | 910 { |
| 871 this._uiSourceCode.removeMessage(this); | 911 this._uiSourceCode.removeMessage(this); |
| 872 } | 912 } |
| 873 } | 913 } |
| 914 |
| 915 /** |
| 916 * @constructor |
| 917 * @param {number} line |
| 918 * @param {string} type |
| 919 * @param {?} data |
| 920 */ |
| 921 WebInspector.UISourceCode.LineMarker = function(line, type, data) |
| 922 { |
| 923 this._line = line; |
| 924 this._type = type; |
| 925 this._data = data; |
| 926 } |
| 927 |
| 928 WebInspector.UISourceCode.LineMarker.prototype = { |
| 929 /** |
| 930 * @return {number} |
| 931 */ |
| 932 line: function() |
| 933 { |
| 934 return this._line; |
| 935 }, |
| 936 |
| 937 /** |
| 938 * @return {string} |
| 939 */ |
| 940 type: function() |
| 941 { |
| 942 return this._type; |
| 943 }, |
| 944 |
| 945 /** |
| 946 * @return {*} |
| 947 */ |
| 948 data: function() |
| 949 { |
| 950 return this._data; |
| 951 } |
| 952 } |
| OLD | NEW |