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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 this._parentPath = parentPath; | 46 this._parentPath = parentPath; |
47 this._name = name; | 47 this._name = name; |
48 this._originURL = originURL; | 48 this._originURL = originURL; |
49 this._url = url; | 49 this._url = url; |
50 this._contentType = contentType; | 50 this._contentType = contentType; |
51 /** @type {!Array.<function(?string)>} */ | 51 /** @type {!Array.<function(?string)>} */ |
52 this._requestContentCallbacks = []; | 52 this._requestContentCallbacks = []; |
53 /** @type {!Array.<!WebInspector.PresentationConsoleMessage>} */ | 53 /** @type {!Array.<!WebInspector.PresentationConsoleMessage>} */ |
54 this._consoleMessages = []; | 54 this._consoleMessages = []; |
55 | 55 |
56 /** | |
57 * @type {!Map.<!WebInspector.Target, !WebInspector.SourceMapping>} | |
58 */ | |
59 this._sourceMappingForTarget = new Map(); | |
60 | |
61 /** | |
62 * @type {!Map.<!WebInspector.Target, !WebInspector.ResourceScriptFile>} | |
63 */ | |
64 this._scriptFileForTarget = new Map(); | |
65 | |
66 /** @type {!Array.<!WebInspector.Revision>} */ | 56 /** @type {!Array.<!WebInspector.Revision>} */ |
67 this.history = []; | 57 this.history = []; |
68 } | 58 } |
69 | 59 |
70 WebInspector.UISourceCode.Events = { | 60 WebInspector.UISourceCode.Events = { |
71 WorkingCopyChanged: "WorkingCopyChanged", | 61 WorkingCopyChanged: "WorkingCopyChanged", |
72 WorkingCopyCommitted: "WorkingCopyCommitted", | 62 WorkingCopyCommitted: "WorkingCopyCommitted", |
73 TitleChanged: "TitleChanged", | 63 TitleChanged: "TitleChanged", |
74 SavedStateUpdated: "SavedStateUpdated", | 64 SavedStateUpdated: "SavedStateUpdated", |
75 ConsoleMessageAdded: "ConsoleMessageAdded", | 65 ConsoleMessageAdded: "ConsoleMessageAdded", |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 206 |
217 /** | 207 /** |
218 * @return {!WebInspector.ResourceType} | 208 * @return {!WebInspector.ResourceType} |
219 */ | 209 */ |
220 contentType: function() | 210 contentType: function() |
221 { | 211 { |
222 return this._contentType; | 212 return this._contentType; |
223 }, | 213 }, |
224 | 214 |
225 /** | 215 /** |
226 * @param {!WebInspector.Target} target | |
227 * @return {?WebInspector.ResourceScriptFile} | |
228 */ | |
229 scriptFileForTarget: function(target) | |
230 { | |
231 return this._scriptFileForTarget.get(target) || null; | |
232 }, | |
233 | |
234 /** | |
235 * @param {!WebInspector.Target} target | |
236 * @param {?WebInspector.ResourceScriptFile} scriptFile | |
237 */ | |
238 setScriptFileForTarget: function(target, scriptFile) | |
239 { | |
240 if (scriptFile) | |
241 this._scriptFileForTarget.put(target, scriptFile); | |
242 else | |
243 this._scriptFileForTarget.remove(target); | |
244 }, | |
245 | |
246 /** | |
247 * @return {!WebInspector.Project} | 216 * @return {!WebInspector.Project} |
248 */ | 217 */ |
249 project: function() | 218 project: function() |
250 { | 219 { |
251 return this._project; | 220 return this._project; |
252 }, | 221 }, |
253 | 222 |
254 /** | 223 /** |
255 * @param {function(?Date, ?number)} callback | 224 * @param {function(?Date, ?number)} callback |
256 */ | 225 */ |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 568 |
600 /** | 569 /** |
601 * @return {boolean} | 570 * @return {boolean} |
602 */ | 571 */ |
603 contentLoaded: function() | 572 contentLoaded: function() |
604 { | 573 { |
605 return this._contentLoaded; | 574 return this._contentLoaded; |
606 }, | 575 }, |
607 | 576 |
608 /** | 577 /** |
609 * @param {!WebInspector.Target} target | |
610 * @param {number} lineNumber | |
611 * @param {number} columnNumber | |
612 * @return {?WebInspector.RawLocation} | |
613 */ | |
614 uiLocationToRawLocation: function(target, lineNumber, columnNumber) | |
615 { | |
616 var sourceMapping = this._sourceMappingForTarget.get(target); | |
617 if (!sourceMapping) | |
618 return null; | |
619 return sourceMapping.uiLocationToRawLocation(this, lineNumber, columnNum
ber); | |
620 }, | |
621 | |
622 /** | |
623 * @param {number} lineNumber | |
624 * @param {number} columnNumber | |
625 * @return {!Array.<!WebInspector.RawLocation>} | |
626 */ | |
627 uiLocationToRawLocations: function(lineNumber, columnNumber) | |
628 { | |
629 var result = []; | |
630 var sourceMappings = this._sourceMappingForTarget.values(); | |
631 for (var i = 0; i < sourceMappings.length; ++i) { | |
632 var rawLocation = sourceMappings[i].uiLocationToRawLocation(this, li
neNumber, columnNumber); | |
633 if (rawLocation) | |
634 result.push(rawLocation); | |
635 } | |
636 return result; | |
637 }, | |
638 | |
639 /** | |
640 * @param {number} lineNumber | |
641 * @return {boolean} | |
642 */ | |
643 uiLineHasMapping: function(lineNumber) | |
644 { | |
645 var sourceMappings = this._sourceMappingForTarget.values(); | |
646 for (var i = 0; i < sourceMappings.length; ++i) { | |
647 var sourceMapping = sourceMappings[i]; | |
648 if (!sourceMappings[i].uiLineHasMapping(this, lineNumber)) | |
649 return false; | |
650 } | |
651 return true; | |
652 }, | |
653 | |
654 /** | |
655 * @return {!Array.<!WebInspector.PresentationConsoleMessage>} | 578 * @return {!Array.<!WebInspector.PresentationConsoleMessage>} |
656 */ | 579 */ |
657 consoleMessages: function() | 580 consoleMessages: function() |
658 { | 581 { |
659 return this._consoleMessages; | 582 return this._consoleMessages; |
660 }, | 583 }, |
661 | 584 |
662 /** | 585 /** |
663 * @param {!WebInspector.PresentationConsoleMessage} message | 586 * @param {!WebInspector.PresentationConsoleMessage} message |
664 */ | 587 */ |
(...skipping 12 matching lines...) Expand all Loading... |
677 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMe
ssageRemoved, message); | 600 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMe
ssageRemoved, message); |
678 }, | 601 }, |
679 | 602 |
680 consoleMessagesCleared: function() | 603 consoleMessagesCleared: function() |
681 { | 604 { |
682 this._consoleMessages = []; | 605 this._consoleMessages = []; |
683 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMe
ssagesCleared); | 606 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMe
ssagesCleared); |
684 }, | 607 }, |
685 | 608 |
686 /** | 609 /** |
687 * @return {boolean} | |
688 */ | |
689 hasSourceMapping: function() | |
690 { | |
691 return !!this._sourceMappingForTarget.size(); | |
692 }, | |
693 | |
694 /** | |
695 * @param {!WebInspector.Target} target | |
696 * @param {?WebInspector.SourceMapping} sourceMapping | |
697 */ | |
698 setSourceMappingForTarget: function(target, sourceMapping) | |
699 { | |
700 if (this._sourceMappingForTarget.get(target) === sourceMapping) | |
701 return; | |
702 | |
703 if (sourceMapping) | |
704 this._sourceMappingForTarget.put(target, sourceMapping); | |
705 else | |
706 this._sourceMappingForTarget.remove(target); | |
707 | |
708 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMap
pingChanged, {target: target, isIdentity: sourceMapping ? sourceMapping.isIdenti
ty() : false}); | |
709 }, | |
710 | |
711 /** | |
712 * @param {number} lineNumber | 610 * @param {number} lineNumber |
713 * @param {number=} columnNumber | 611 * @param {number=} columnNumber |
714 * @return {!WebInspector.UILocation} | 612 * @return {!WebInspector.UILocation} |
715 */ | 613 */ |
716 uiLocation: function(lineNumber, columnNumber) | 614 uiLocation: function(lineNumber, columnNumber) |
717 { | 615 { |
718 if (typeof columnNumber === "undefined") | 616 if (typeof columnNumber === "undefined") |
719 columnNumber = 0; | 617 columnNumber = 0; |
720 return new WebInspector.UILocation(this, lineNumber, columnNumber); | 618 return new WebInspector.UILocation(this, lineNumber, columnNumber); |
721 }, | 619 }, |
722 | 620 |
723 __proto__: WebInspector.Object.prototype | 621 __proto__: WebInspector.Object.prototype |
724 } | 622 } |
725 | 623 |
726 /** | 624 /** |
727 * @constructor | 625 * @constructor |
728 * @param {!WebInspector.UISourceCode} uiSourceCode | 626 * @param {!WebInspector.UISourceCode} uiSourceCode |
729 * @param {number} lineNumber | 627 * @param {number} lineNumber |
730 * @param {number} columnNumber | 628 * @param {number} columnNumber |
731 */ | 629 */ |
732 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) | 630 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber) |
733 { | 631 { |
734 this.uiSourceCode = uiSourceCode; | 632 this.uiSourceCode = uiSourceCode; |
735 this.lineNumber = lineNumber; | 633 this.lineNumber = lineNumber; |
736 this.columnNumber = columnNumber; | 634 this.columnNumber = columnNumber; |
737 } | 635 } |
738 | 636 |
739 WebInspector.UILocation.prototype = { | 637 WebInspector.UILocation.prototype = { |
740 /** | 638 /** |
741 * @param {!WebInspector.Target} target | |
742 * @return {?WebInspector.RawLocation} | |
743 */ | |
744 uiLocationToRawLocation: function(target) | |
745 { | |
746 return this.uiSourceCode.uiLocationToRawLocation(target, this.lineNumber
, this.columnNumber); | |
747 }, | |
748 | |
749 /** | |
750 * @return {!Array.<!WebInspector.RawLocation>} | |
751 */ | |
752 uiLocationToRawLocations: function() | |
753 { | |
754 return this.uiSourceCode.uiLocationToRawLocations(this.lineNumber, this.
columnNumber); | |
755 }, | |
756 | |
757 /** | |
758 * @return {string} | 639 * @return {string} |
759 */ | 640 */ |
760 linkText: function() | 641 linkText: function() |
761 { | 642 { |
762 var linkText = this.uiSourceCode.displayName(); | 643 var linkText = this.uiSourceCode.displayName(); |
763 if (typeof this.lineNumber === "number") | 644 if (typeof this.lineNumber === "number") |
764 linkText += ":" + (this.lineNumber + 1); | 645 linkText += ":" + (this.lineNumber + 1); |
765 return linkText; | 646 return linkText; |
766 }, | 647 }, |
767 | 648 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 * @param {string} query | 786 * @param {string} query |
906 * @param {boolean} caseSensitive | 787 * @param {boolean} caseSensitive |
907 * @param {boolean} isRegex | 788 * @param {boolean} isRegex |
908 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback | 789 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback |
909 */ | 790 */ |
910 searchInContent: function(query, caseSensitive, isRegex, callback) | 791 searchInContent: function(query, caseSensitive, isRegex, callback) |
911 { | 792 { |
912 callback([]); | 793 callback([]); |
913 } | 794 } |
914 } | 795 } |
OLD | NEW |