| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /** @type {!Map.<!SDK.ResourceTreeFrame, !Sources.NavigatorGroupTreeNode>} *
/ | 51 /** @type {!Map.<!SDK.ResourceTreeFrame, !Sources.NavigatorGroupTreeNode>} *
/ |
| 52 this._frameNodes = new Map(); | 52 this._frameNodes = new Map(); |
| 53 | 53 |
| 54 this.element.addEventListener('contextmenu', this.handleContextMenu.bind(thi
s), false); | 54 this.element.addEventListener('contextmenu', this.handleContextMenu.bind(thi
s), false); |
| 55 | 55 |
| 56 this._navigatorGroupByFolderSetting = Common.moduleSetting('navigatorGroupBy
Folder'); | 56 this._navigatorGroupByFolderSetting = Common.moduleSetting('navigatorGroupBy
Folder'); |
| 57 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); | 57 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); |
| 58 | 58 |
| 59 this._initGrouping(); | 59 this._initGrouping(); |
| 60 SDK.targetManager.addModelListener( | |
| 61 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); | |
| 62 SDK.targetManager.addModelListener( | |
| 63 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameDetached, this.
_frameDetached, this); | |
| 64 | 60 |
| 65 if (Runtime.experiments.isEnabled('persistence2')) { | 61 if (Runtime.experiments.isEnabled('persistence2')) { |
| 66 Persistence.persistence.addEventListener( | 62 Persistence.persistence.addEventListener( |
| 67 Persistence.Persistence.Events.BindingCreated, this._onBindingChanged,
this); | 63 Persistence.Persistence.Events.BindingCreated, this._onBindingChanged,
this); |
| 68 Persistence.persistence.addEventListener( | 64 Persistence.persistence.addEventListener( |
| 69 Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged,
this); | 65 Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged,
this); |
| 70 } else { | 66 } else { |
| 71 Persistence.persistence.addEventListener( | 67 Persistence.persistence.addEventListener( |
| 72 Persistence.Persistence.Events.BindingCreated, this._onBindingCreated,
this); | 68 Persistence.Persistence.Events.BindingCreated, this._onBindingCreated,
this); |
| 73 Persistence.persistence.addEventListener( | 69 Persistence.persistence.addEventListener( |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 this._groupByDomain = this._navigatorGroupByFolderSetting.get(); | 747 this._groupByDomain = this._navigatorGroupByFolderSetting.get(); |
| 752 this._groupByFolder = this._groupByDomain; | 748 this._groupByFolder = this._groupByDomain; |
| 753 } | 749 } |
| 754 | 750 |
| 755 _resetForTest() { | 751 _resetForTest() { |
| 756 this.reset(); | 752 this.reset(); |
| 757 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); | 753 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); |
| 758 } | 754 } |
| 759 | 755 |
| 760 /** | 756 /** |
| 761 * @param {!Common.Event} event | |
| 762 */ | |
| 763 _frameNavigated(event) { | |
| 764 var frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data); | |
| 765 var node = this._frameNodes.get(frame); | |
| 766 if (!node) | |
| 767 return; | |
| 768 | |
| 769 node.treeNode().title = frame.displayName(); | |
| 770 for (var child of frame.childFrames) | |
| 771 this._discardFrame(child); | |
| 772 } | |
| 773 | |
| 774 /** | |
| 775 * @param {!Common.Event} event | |
| 776 */ | |
| 777 _frameDetached(event) { | |
| 778 var frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data); | |
| 779 this._discardFrame(frame); | |
| 780 } | |
| 781 | |
| 782 /** | |
| 783 * @param {!SDK.ResourceTreeFrame} frame | 757 * @param {!SDK.ResourceTreeFrame} frame |
| 784 */ | 758 */ |
| 785 _discardFrame(frame) { | 759 _discardFrame(frame) { |
| 786 var node = this._frameNodes.get(frame); | 760 var node = this._frameNodes.get(frame); |
| 787 if (!node) | 761 if (!node) |
| 788 return; | 762 return; |
| 789 | 763 |
| 790 if (node.parent) | 764 if (node.parent) |
| 791 node.parent.removeChild(node); | 765 node.parent.removeChild(node); |
| 792 this._frameNodes.delete(frame); | 766 this._frameNodes.delete(frame); |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 /** | 1586 /** |
| 1613 * @param {string} title | 1587 * @param {string} title |
| 1614 * @override | 1588 * @override |
| 1615 */ | 1589 */ |
| 1616 setTitle(title) { | 1590 setTitle(title) { |
| 1617 this._title = title; | 1591 this._title = title; |
| 1618 if (this._treeElement) | 1592 if (this._treeElement) |
| 1619 this._treeElement.title = this._title; | 1593 this._treeElement.title = this._title; |
| 1620 } | 1594 } |
| 1621 }; | 1595 }; |
| OLD | NEW |