Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
|
dgozman
2017/03/17 17:50:11
One of the files should have new copyright.
eostroukhov
2017/03/17 19:01:12
ApplicationPanelSidebar retains the code so it wil
| |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 12 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @implements {SDK.TargetManager.Observer} | 31 * @implements {SDK.TargetManager.Observer} |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 Resources.ResourcesPanel = class extends UI.PanelWithSidebar { | 34 Resources.ApplicationPanelSidebar = class extends Common.Object { |
| 35 constructor() { | 35 /** |
| 36 super('resources'); | 36 * @param {!Element} sidebarElement |
| 37 this.registerRequiredCSS('resources/resourcesPanel.css'); | 37 * @param {!UI.SplitWidget} splitWidget |
| 38 | 38 */ |
| 39 constructor(sidebarElement, splitWidget) { | |
| 40 super(); | |
| 39 this._resourcesLastSelectedItemSetting = Common.settings.createSetting('reso urcesLastSelectedItem', {}); | 41 this._resourcesLastSelectedItemSetting = Common.settings.createSetting('reso urcesLastSelectedItem', {}); |
| 40 | 42 |
| 41 this._sidebarTree = new UI.TreeOutlineInShadow(); | 43 this._sidebarTree = new UI.TreeOutlineInShadow(); |
| 42 this._sidebarTree.element.classList.add('resources-sidebar'); | 44 this._sidebarTree.element.classList.add('resources-sidebar'); |
| 43 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); | 45 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); |
| 44 this._sidebarTree.element.classList.add('filter-all'); | 46 this._sidebarTree.element.classList.add('filter-all'); |
| 45 this.panelSidebarElement().appendChild(this._sidebarTree.element); | 47 sidebarElement.appendChild(this._sidebarTree.element); |
|
dgozman
2017/03/17 17:50:11
Instead of passing sidebarElement, let's have this
eostroukhov
2017/03/17 19:01:12
Done.
| |
| 46 | 48 |
| 47 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication')); | 49 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication')); |
| 48 this._manifestTreeElement = new Resources.AppManifestTreeElement(this); | 50 this._manifestTreeElement = new Resources.AppManifestTreeElement(this); |
| 49 this._applicationTreeElement.appendChild(this._manifestTreeElement); | 51 this._applicationTreeElement.appendChild(this._manifestTreeElement); |
| 50 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(thi s); | 52 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(thi s); |
| 51 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); | 53 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); |
| 52 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(this); | 54 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(this); |
| 53 this._applicationTreeElement.appendChild(clearStorageTreeElement); | 55 this._applicationTreeElement.appendChild(clearStorageTreeElement); |
| 54 | 56 |
| 55 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage')) ; | 57 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage')) ; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 86 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree -item'); | 88 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree -item'); |
| 87 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon]) ; | 89 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon]) ; |
| 88 | 90 |
| 89 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); | 91 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); |
| 90 | 92 |
| 91 this._resourcesSection = new Resources.ResourcesSection(this, this._addSideb arSection(Common.UIString('Frames'))); | 93 this._resourcesSection = new Resources.ResourcesSection(this, this._addSideb arSection(Common.UIString('Frames'))); |
| 92 | 94 |
| 93 var mainContainer = new UI.VBox(); | 95 var mainContainer = new UI.VBox(); |
| 94 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto '); | 96 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto '); |
| 95 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element); | 97 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element); |
| 96 this.splitWidget().setMainWidget(mainContainer); | 98 splitWidget.setMainWidget(mainContainer); |
|
dgozman
2017/03/17 17:50:11
Same for splitWidget.
eostroukhov
2017/03/17 19:01:12
Done.
| |
| 97 | 99 |
| 98 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */ | 100 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */ |
| 99 this._databaseTableViews = new Map(); | 101 this._databaseTableViews = new Map(); |
| 100 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ | 102 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ |
| 101 this._databaseQueryViews = new Map(); | 103 this._databaseQueryViews = new Map(); |
| 102 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ | 104 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ |
| 103 this._databaseTreeElements = new Map(); | 105 this._databaseTreeElements = new Map(); |
| 104 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} * / | 106 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} * / |
| 105 this._domStorageTreeElements = new Map(); | 107 this._domStorageTreeElements = new Map(); |
| 106 /** @type {!Object.<string, boolean>} */ | 108 /** @type {!Object.<string, boolean>} */ |
| 107 this._domains = {}; | 109 this._domains = {}; |
| 108 | 110 |
| 109 /** @type {?Resources.DOMStorageItemsView} */ | 111 /** @type {?Resources.DOMStorageItemsView} */ |
| 110 this._domStorageView = null; | 112 this._domStorageView = null; |
| 111 /** @type {?Resources.CookieItemsView} */ | 113 /** @type {?Resources.CookieItemsView} */ |
| 112 this._cookieView = null; | 114 this._cookieView = null; |
| 113 | 115 |
| 114 this.panelSidebarElement().addEventListener('mousemove', this._onmousemove.b ind(this), false); | 116 sidebarElement.addEventListener('mousemove', this._onmousemove.bind(this), f alse); |
| 115 this.panelSidebarElement().addEventListener('mouseleave', this._onmouseleave .bind(this), false); | 117 sidebarElement.addEventListener('mouseleave', this._onmouseleave.bind(this), false); |
| 116 | 118 |
| 117 SDK.targetManager.observeTargets(this); | 119 SDK.targetManager.observeTargets(this); |
| 118 SDK.targetManager.addModelListener( | 120 SDK.targetManager.addModelListener( |
| 119 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this); | 121 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this); |
| 120 } | 122 } |
| 121 | 123 |
| 122 /** | 124 /** |
| 123 * @return {!Resources.ResourcesPanel} | 125 * @return {!Resources.ApplicationPanelSidebar} |
| 124 */ | 126 */ |
| 125 static _instance() { | 127 static _instance() { |
|
dgozman
2017/03/17 17:50:11
Who needs this?
eostroukhov
2017/03/17 19:01:12
Done.
| |
| 126 return /** @type {!Resources.ResourcesPanel} */ (self.runtime.sharedInstance (Resources.ResourcesPanel)); | 128 return /** @type {!Resources.ApplicationPanelSidebar} */ ( |
| 129 self.runtime.sharedInstance(Resources.ApplicationPanelSidebar)); | |
|
dgozman
2017/03/17 17:50:11
Note this requires a declaration in module.json.
eostroukhov
2017/03/17 19:01:12
Code was removed
| |
| 127 } | 130 } |
| 128 | 131 |
| 129 /** | 132 /** |
| 130 * @param {string} title | 133 * @param {string} title |
| 131 * @return {!UI.TreeElement} | 134 * @return {!UI.TreeElement} |
| 132 */ | 135 */ |
| 133 _addSidebarSection(title) { | 136 _addSidebarSection(title) { |
| 134 var treeElement = new UI.TreeElement(title, true); | 137 var treeElement = new UI.TreeElement(title, true); |
| 135 treeElement.listItemElement.classList.add('storage-group-list-item'); | 138 treeElement.listItemElement.classList.add('storage-group-list-item'); |
| 136 treeElement.setCollapsible(false); | 139 treeElement.setCollapsible(false); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.CachedR esourcesLoaded, this._initialize, this); | 181 resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.CachedR esourcesLoaded, this._initialize, this); |
| 179 resourceTreeModel.removeEventListener( | 182 resourceTreeModel.removeEventListener( |
| 180 SDK.ResourceTreeModel.Events.WillLoadCachedResources, this._resetWithF rames, this); | 183 SDK.ResourceTreeModel.Events.WillLoadCachedResources, this._resetWithF rames, this); |
| 181 } | 184 } |
| 182 this._databaseModel.off(Resources.DatabaseModel.DatabaseAddedEvent, this._da tabaseAdded, this); | 185 this._databaseModel.off(Resources.DatabaseModel.DatabaseAddedEvent, this._da tabaseAdded, this); |
| 183 this._databaseModel.off(Resources.DatabaseModel.DatabasesRemovedEvent, this. _resetWebSQL, this); | 186 this._databaseModel.off(Resources.DatabaseModel.DatabasesRemovedEvent, this. _resetWebSQL, this); |
| 184 | 187 |
| 185 this._resetWithFrames(); | 188 this._resetWithFrames(); |
| 186 } | 189 } |
| 187 | 190 |
| 188 /** | |
| 189 * @override | |
| 190 */ | |
| 191 focus() { | 191 focus() { |
|
dgozman
2017/03/17 17:50:11
Who is calling this method now? Should we make thi
eostroukhov
2017/03/17 19:01:12
Panel will now directly set focus on a sidebar tre
| |
| 192 this._sidebarTree.focus(); | 192 this._sidebarTree.focus(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 _initialize() { | 195 _initialize() { |
| 196 for (var frame of SDK.ResourceTreeModel.frames()) | 196 for (var frame of SDK.ResourceTreeModel.frames()) |
| 197 this._addCookieDocument(frame); | 197 this._addCookieDocument(frame); |
| 198 this._databaseModel.enable(); | 198 this._databaseModel.enable(); |
| 199 | 199 |
| 200 var indexedDBModel = Resources.IndexedDBModel.fromTarget(this._target); | 200 var indexedDBModel = Resources.IndexedDBModel.fromTarget(this._target); |
| 201 if (indexedDBModel) | 201 if (indexedDBModel) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 this._showDatabase(database); | 398 this._showDatabase(database); |
| 399 this._databaseTreeElements.get(database).select(); | 399 this._databaseTreeElements.get(database).select(); |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 | 402 |
| 403 /** | 403 /** |
| 404 * @param {!Resources.DOMStorage} domStorage | 404 * @param {!Resources.DOMStorage} domStorage |
| 405 */ | 405 */ |
| 406 selectDOMStorage(domStorage) { | 406 selectDOMStorage(domStorage) { |
| 407 if (domStorage) { | 407 if (domStorage) { |
| 408 this._showDOMStorage(domStorage); | 408 this.showDOMStorage(domStorage); |
| 409 this._domStorageTreeElements.get(domStorage).select(); | 409 this._domStorageTreeElements.get(domStorage).select(); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 /** | 413 /** |
| 414 * @param {!SDK.Resource} resource | 414 * @param {!SDK.Resource} resource |
| 415 * @param {number=} line | 415 * @param {number=} line |
| 416 * @param {number=} column | 416 * @param {number=} column |
| 417 * @return {boolean} | 417 * @return {boolean} |
| 418 */ | 418 */ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 view.addEventListener(Resources.DatabaseQueryView.Events.SchemaUpdated, this._updateDatabaseTables, this); | 468 view.addEventListener(Resources.DatabaseQueryView.Events.SchemaUpdated, this._updateDatabaseTables, this); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 this._innerShowView(view); | 472 this._innerShowView(view); |
| 473 } | 473 } |
| 474 | 474 |
| 475 /** | 475 /** |
| 476 * @param {!Resources.DOMStorage} domStorage | 476 * @param {!Resources.DOMStorage} domStorage |
| 477 */ | 477 */ |
| 478 _showDOMStorage(domStorage) { | 478 showDOMStorage(domStorage) { |
| 479 if (!domStorage) | 479 if (!domStorage) |
| 480 return; | 480 return; |
| 481 | 481 |
| 482 if (!this._domStorageView) | 482 if (!this._domStorageView) |
| 483 this._domStorageView = new Resources.DOMStorageItemsView(domStorage); | 483 this._domStorageView = new Resources.DOMStorageItemsView(domStorage); |
| 484 else | 484 else |
| 485 this._domStorageView.setStorage(domStorage); | 485 this._domStorageView.setStorage(domStorage); |
| 486 this._innerShowView(this._domStorageView); | 486 this._innerShowView(this._domStorageView); |
| 487 } | 487 } |
| 488 | 488 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 | 708 |
| 709 _onmouseleave(event) { | 709 _onmouseleave(event) { |
| 710 if (this._previousHoveredElement) { | 710 if (this._previousHoveredElement) { |
| 711 this._previousHoveredElement.hovered = false; | 711 this._previousHoveredElement.hovered = false; |
| 712 delete this._previousHoveredElement; | 712 delete this._previousHoveredElement; |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 }; | 715 }; |
| 716 | 716 |
| 717 /** | 717 /** |
| 718 * @implements {Common.Revealer} | |
| 719 * @unrestricted | |
| 720 */ | |
| 721 Resources.ResourcesPanel.ResourceRevealer = class { | |
| 722 /** | |
| 723 * @override | |
| 724 * @param {!Object} resource | |
| 725 * @return {!Promise} | |
| 726 */ | |
| 727 reveal(resource) { | |
| 728 if (!(resource instanceof SDK.Resource)) | |
| 729 return Promise.reject(new Error('Internal error: not a resource')); | |
| 730 var panel = Resources.ResourcesPanel._instance(); | |
| 731 return UI.viewManager.showView('resources').then(panel.showResource.bind(pan el, resource)); | |
| 732 } | |
| 733 }; | |
| 734 | |
| 735 /** | |
| 736 * @unrestricted | 718 * @unrestricted |
| 737 */ | 719 */ |
| 738 Resources.BaseStorageTreeElement = class extends UI.TreeElement { | 720 Resources.BaseStorageTreeElement = class extends UI.TreeElement { |
| 739 /** | 721 /** |
| 740 * @param {!Resources.ResourcesPanel} storagePanel | 722 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 741 * @param {string} title | 723 * @param {string} title |
| 742 * @param {boolean} expandable | 724 * @param {boolean} expandable |
| 743 */ | 725 */ |
| 744 constructor(storagePanel, title, expandable) { | 726 constructor(storagePanel, title, expandable) { |
| 745 super(title, expandable); | 727 super(title, expandable); |
| 746 this._storagePanel = storagePanel; | 728 this._storagePanel = storagePanel; |
| 747 } | 729 } |
| 748 | 730 |
| 749 /** | 731 /** |
| 750 * @override | 732 * @override |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 770 } | 752 } |
| 771 this._storagePanel._innerShowView(view); | 753 this._storagePanel._innerShowView(view); |
| 772 } | 754 } |
| 773 }; | 755 }; |
| 774 | 756 |
| 775 /** | 757 /** |
| 776 * @unrestricted | 758 * @unrestricted |
| 777 */ | 759 */ |
| 778 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl ement { | 760 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl ement { |
| 779 /** | 761 /** |
| 780 * @param {!Resources.ResourcesPanel} storagePanel | 762 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 781 * @param {string} categoryName | 763 * @param {string} categoryName |
| 782 * @param {string} settingsKey | 764 * @param {string} settingsKey |
| 783 */ | 765 */ |
| 784 constructor(storagePanel, categoryName, settingsKey) { | 766 constructor(storagePanel, categoryName, settingsKey) { |
| 785 super(storagePanel, categoryName, false); | 767 super(storagePanel, categoryName, false); |
| 786 this._expandedSetting = | 768 this._expandedSetting = |
| 787 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se ttingsKey === 'Frames'); | 769 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se ttingsKey === 'Frames'); |
| 788 this._categoryName = categoryName; | 770 this._categoryName = categoryName; |
| 789 } | 771 } |
| 790 | 772 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 oncollapse() { | 813 oncollapse() { |
| 832 this._expandedSetting.set(false); | 814 this._expandedSetting.set(false); |
| 833 } | 815 } |
| 834 }; | 816 }; |
| 835 | 817 |
| 836 /** | 818 /** |
| 837 * @unrestricted | 819 * @unrestricted |
| 838 */ | 820 */ |
| 839 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { | 821 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { |
| 840 /** | 822 /** |
| 841 * @param {!Resources.ResourcesPanel} storagePanel | 823 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 842 * @param {!Resources.Database} database | 824 * @param {!Resources.Database} database |
| 843 */ | 825 */ |
| 844 constructor(storagePanel, database) { | 826 constructor(storagePanel, database) { |
| 845 super(storagePanel, database.name, true); | 827 super(storagePanel, database.name, true); |
| 846 this._database = database; | 828 this._database = database; |
| 847 | 829 |
| 848 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 830 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 849 this.setLeadingIcons([icon]); | 831 this.setLeadingIcons([icon]); |
| 850 } | 832 } |
| 851 | 833 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 this._storagePanel._showDatabase(this._database, this._tableName); | 893 this._storagePanel._showDatabase(this._database, this._tableName); |
| 912 return false; | 894 return false; |
| 913 } | 895 } |
| 914 }; | 896 }; |
| 915 | 897 |
| 916 /** | 898 /** |
| 917 * @unrestricted | 899 * @unrestricted |
| 918 */ | 900 */ |
| 919 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement { | 901 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement { |
| 920 /** | 902 /** |
| 921 * @param {!Resources.ResourcesPanel} storagePanel | 903 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 922 */ | 904 */ |
| 923 constructor(storagePanel) { | 905 constructor(storagePanel) { |
| 924 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); | 906 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); |
| 925 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 907 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 926 this.setLeadingIcons([icon]); | 908 this.setLeadingIcons([icon]); |
| 927 } | 909 } |
| 928 | 910 |
| 929 _initialize() { | 911 _initialize() { |
| 930 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ | 912 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ |
| 931 this._swCacheTreeElements = []; | 913 this._swCacheTreeElements = []; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 return this._swCacheTreeElements[i]; | 999 return this._swCacheTreeElements[i]; |
| 1018 return null; | 1000 return null; |
| 1019 } | 1001 } |
| 1020 }; | 1002 }; |
| 1021 | 1003 |
| 1022 /** | 1004 /** |
| 1023 * @unrestricted | 1005 * @unrestricted |
| 1024 */ | 1006 */ |
| 1025 Resources.SWCacheTreeElement = class extends Resources.BaseStorageTreeElement { | 1007 Resources.SWCacheTreeElement = class extends Resources.BaseStorageTreeElement { |
| 1026 /** | 1008 /** |
| 1027 * @param {!Resources.ResourcesPanel} storagePanel | 1009 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1028 * @param {!SDK.ServiceWorkerCacheModel} model | 1010 * @param {!SDK.ServiceWorkerCacheModel} model |
| 1029 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache | 1011 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache |
| 1030 */ | 1012 */ |
| 1031 constructor(storagePanel, model, cache) { | 1013 constructor(storagePanel, model, cache) { |
| 1032 super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, false); | 1014 super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, false); |
| 1033 this._model = model; | 1015 this._model = model; |
| 1034 this._cache = cache; | 1016 this._cache = cache; |
| 1035 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); | 1017 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); |
| 1036 this.setLeadingIcons([icon]); | 1018 this.setLeadingIcons([icon]); |
| 1037 } | 1019 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 if (this._view) | 1067 if (this._view) |
| 1086 this._view.clear(); | 1068 this._view.clear(); |
| 1087 } | 1069 } |
| 1088 }; | 1070 }; |
| 1089 | 1071 |
| 1090 /** | 1072 /** |
| 1091 * @unrestricted | 1073 * @unrestricted |
| 1092 */ | 1074 */ |
| 1093 Resources.ServiceWorkersTreeElement = class extends Resources.BaseStorageTreeEle ment { | 1075 Resources.ServiceWorkersTreeElement = class extends Resources.BaseStorageTreeEle ment { |
| 1094 /** | 1076 /** |
| 1095 * @param {!Resources.ResourcesPanel} storagePanel | 1077 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1096 */ | 1078 */ |
| 1097 constructor(storagePanel) { | 1079 constructor(storagePanel) { |
| 1098 super(storagePanel, Common.UIString('Service Workers'), false); | 1080 super(storagePanel, Common.UIString('Service Workers'), false); |
| 1099 var icon = UI.Icon.create('mediumicon-service-worker', 'resource-tree-item') ; | 1081 var icon = UI.Icon.create('mediumicon-service-worker', 'resource-tree-item') ; |
| 1100 this.setLeadingIcons([icon]); | 1082 this.setLeadingIcons([icon]); |
| 1101 } | 1083 } |
| 1102 | 1084 |
| 1103 /** | 1085 /** |
| 1104 * @return {string} | 1086 * @return {string} |
| 1105 */ | 1087 */ |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1118 this.showView(this._view); | 1100 this.showView(this._view); |
| 1119 return false; | 1101 return false; |
| 1120 } | 1102 } |
| 1121 }; | 1103 }; |
| 1122 | 1104 |
| 1123 /** | 1105 /** |
| 1124 * @unrestricted | 1106 * @unrestricted |
| 1125 */ | 1107 */ |
| 1126 Resources.AppManifestTreeElement = class extends Resources.BaseStorageTreeElemen t { | 1108 Resources.AppManifestTreeElement = class extends Resources.BaseStorageTreeElemen t { |
| 1127 /** | 1109 /** |
| 1128 * @param {!Resources.ResourcesPanel} storagePanel | 1110 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1129 */ | 1111 */ |
| 1130 constructor(storagePanel) { | 1112 constructor(storagePanel) { |
| 1131 super(storagePanel, Common.UIString('Manifest'), false); | 1113 super(storagePanel, Common.UIString('Manifest'), false); |
| 1132 var icon = UI.Icon.create('mediumicon-manifest', 'resource-tree-item'); | 1114 var icon = UI.Icon.create('mediumicon-manifest', 'resource-tree-item'); |
| 1133 this.setLeadingIcons([icon]); | 1115 this.setLeadingIcons([icon]); |
| 1134 } | 1116 } |
| 1135 | 1117 |
| 1136 /** | 1118 /** |
| 1137 * @return {string} | 1119 * @return {string} |
| 1138 */ | 1120 */ |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1151 this.showView(this._view); | 1133 this.showView(this._view); |
| 1152 return false; | 1134 return false; |
| 1153 } | 1135 } |
| 1154 }; | 1136 }; |
| 1155 | 1137 |
| 1156 /** | 1138 /** |
| 1157 * @unrestricted | 1139 * @unrestricted |
| 1158 */ | 1140 */ |
| 1159 Resources.ClearStorageTreeElement = class extends Resources.BaseStorageTreeEleme nt { | 1141 Resources.ClearStorageTreeElement = class extends Resources.BaseStorageTreeEleme nt { |
| 1160 /** | 1142 /** |
| 1161 * @param {!Resources.ResourcesPanel} storagePanel | 1143 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1162 */ | 1144 */ |
| 1163 constructor(storagePanel) { | 1145 constructor(storagePanel) { |
| 1164 super(storagePanel, Common.UIString('Clear storage'), false); | 1146 super(storagePanel, Common.UIString('Clear storage'), false); |
| 1165 var icon = UI.Icon.create('mediumicon-clear-storage', 'resource-tree-item'); | 1147 var icon = UI.Icon.create('mediumicon-clear-storage', 'resource-tree-item'); |
| 1166 this.setLeadingIcons([icon]); | 1148 this.setLeadingIcons([icon]); |
| 1167 } | 1149 } |
| 1168 | 1150 |
| 1169 /** | 1151 /** |
| 1170 * @return {string} | 1152 * @return {string} |
| 1171 */ | 1153 */ |
| 1172 get itemURL() { | 1154 get itemURL() { |
| 1173 return 'clear-storage://'; | 1155 return 'clear-storage://'; |
| 1174 } | 1156 } |
| 1175 | 1157 |
| 1176 /** | 1158 /** |
| 1177 * @override | 1159 * @override |
| 1178 * @return {boolean} | 1160 * @return {boolean} |
| 1179 */ | 1161 */ |
| 1180 onselect(selectedByUser) { | 1162 onselect(selectedByUser) { |
| 1181 super.onselect(selectedByUser); | 1163 super.onselect(selectedByUser); |
| 1182 if (!this._view) | 1164 if (!this._view) |
| 1183 this._view = new Resources.ClearStorageView(this._storagePanel); | 1165 this._view = new Resources.ClearStorageView(); |
| 1184 this.showView(this._view); | 1166 this.showView(this._view); |
| 1185 return false; | 1167 return false; |
| 1186 } | 1168 } |
| 1187 }; | 1169 }; |
| 1188 | 1170 |
| 1189 /** | 1171 /** |
| 1190 * @unrestricted | 1172 * @unrestricted |
| 1191 */ | 1173 */ |
| 1192 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent { | 1174 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent { |
| 1193 /** | 1175 /** |
| 1194 * @param {!Resources.ResourcesPanel} storagePanel | 1176 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1195 */ | 1177 */ |
| 1196 constructor(storagePanel) { | 1178 constructor(storagePanel) { |
| 1197 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB'); | 1179 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB'); |
| 1198 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 1180 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 1199 this.setLeadingIcons([icon]); | 1181 this.setLeadingIcons([icon]); |
| 1200 } | 1182 } |
| 1201 | 1183 |
| 1202 _initialize() { | 1184 _initialize() { |
| 1203 SDK.targetManager.addModelListener( | 1185 SDK.targetManager.addModelListener( |
| 1204 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded, this._indexedDBAdded, this); | 1186 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded, this._indexedDBAdded, this); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1306 return this._idbDatabaseTreeElements[i]; | 1288 return this._idbDatabaseTreeElements[i]; |
| 1307 return null; | 1289 return null; |
| 1308 } | 1290 } |
| 1309 }; | 1291 }; |
| 1310 | 1292 |
| 1311 /** | 1293 /** |
| 1312 * @unrestricted | 1294 * @unrestricted |
| 1313 */ | 1295 */ |
| 1314 Resources.IDBDatabaseTreeElement = class extends Resources.BaseStorageTreeElemen t { | 1296 Resources.IDBDatabaseTreeElement = class extends Resources.BaseStorageTreeElemen t { |
| 1315 /** | 1297 /** |
| 1316 * @param {!Resources.ResourcesPanel} storagePanel | 1298 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1317 * @param {!Resources.IndexedDBModel} model | 1299 * @param {!Resources.IndexedDBModel} model |
| 1318 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId | 1300 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId |
| 1319 */ | 1301 */ |
| 1320 constructor(storagePanel, model, databaseId) { | 1302 constructor(storagePanel, model, databaseId) { |
| 1321 super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, fal se); | 1303 super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, fal se); |
| 1322 this._model = model; | 1304 this._model = model; |
| 1323 this._databaseId = databaseId; | 1305 this._databaseId = databaseId; |
| 1324 this._idbObjectStoreTreeElements = {}; | 1306 this._idbObjectStoreTreeElements = {}; |
| 1325 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 1307 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 1326 this.setLeadingIcons([icon]); | 1308 this.setLeadingIcons([icon]); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1407 for (var objectStoreName in this._idbObjectStoreTreeElements) | 1389 for (var objectStoreName in this._idbObjectStoreTreeElements) |
| 1408 this._objectStoreRemoved(objectStoreName); | 1390 this._objectStoreRemoved(objectStoreName); |
| 1409 } | 1391 } |
| 1410 }; | 1392 }; |
| 1411 | 1393 |
| 1412 /** | 1394 /** |
| 1413 * @unrestricted | 1395 * @unrestricted |
| 1414 */ | 1396 */ |
| 1415 Resources.IDBObjectStoreTreeElement = class extends Resources.BaseStorageTreeEle ment { | 1397 Resources.IDBObjectStoreTreeElement = class extends Resources.BaseStorageTreeEle ment { |
| 1416 /** | 1398 /** |
| 1417 * @param {!Resources.ResourcesPanel} storagePanel | 1399 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1418 * @param {!Resources.IndexedDBModel} model | 1400 * @param {!Resources.IndexedDBModel} model |
| 1419 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId | 1401 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId |
| 1420 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore | 1402 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore |
| 1421 */ | 1403 */ |
| 1422 constructor(storagePanel, model, databaseId, objectStore) { | 1404 constructor(storagePanel, model, databaseId, objectStore) { |
| 1423 super(storagePanel, objectStore.name, false); | 1405 super(storagePanel, objectStore.name, false); |
| 1424 this._model = model; | 1406 this._model = model; |
| 1425 this._databaseId = databaseId; | 1407 this._databaseId = databaseId; |
| 1426 this._idbIndexTreeElements = {}; | 1408 this._idbIndexTreeElements = {}; |
| 1427 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); | 1409 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 if (this._view) | 1514 if (this._view) |
| 1533 this._view.clear(); | 1515 this._view.clear(); |
| 1534 } | 1516 } |
| 1535 }; | 1517 }; |
| 1536 | 1518 |
| 1537 /** | 1519 /** |
| 1538 * @unrestricted | 1520 * @unrestricted |
| 1539 */ | 1521 */ |
| 1540 Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement { | 1522 Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement { |
| 1541 /** | 1523 /** |
| 1542 * @param {!Resources.ResourcesPanel} storagePanel | 1524 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1543 * @param {!Resources.IndexedDBModel} model | 1525 * @param {!Resources.IndexedDBModel} model |
| 1544 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId | 1526 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId |
| 1545 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore | 1527 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore |
| 1546 * @param {!Resources.IndexedDBModel.Index} index | 1528 * @param {!Resources.IndexedDBModel.Index} index |
| 1547 */ | 1529 */ |
| 1548 constructor(storagePanel, model, databaseId, objectStore, index) { | 1530 constructor(storagePanel, model, databaseId, objectStore, index) { |
| 1549 super(storagePanel, index.name, false); | 1531 super(storagePanel, index.name, false); |
| 1550 this._model = model; | 1532 this._model = model; |
| 1551 this._databaseId = databaseId; | 1533 this._databaseId = databaseId; |
| 1552 this._objectStore = objectStore; | 1534 this._objectStore = objectStore; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1615 return 'storage://' + this._domStorage.securityOrigin + '/' + | 1597 return 'storage://' + this._domStorage.securityOrigin + '/' + |
| 1616 (this._domStorage.isLocalStorage ? 'local' : 'session'); | 1598 (this._domStorage.isLocalStorage ? 'local' : 'session'); |
| 1617 } | 1599 } |
| 1618 | 1600 |
| 1619 /** | 1601 /** |
| 1620 * @override | 1602 * @override |
| 1621 * @return {boolean} | 1603 * @return {boolean} |
| 1622 */ | 1604 */ |
| 1623 onselect(selectedByUser) { | 1605 onselect(selectedByUser) { |
| 1624 super.onselect(selectedByUser); | 1606 super.onselect(selectedByUser); |
| 1625 this._storagePanel._showDOMStorage(this._domStorage); | 1607 this._storagePanel.showDOMStorage(this._domStorage); |
| 1626 return false; | 1608 return false; |
| 1627 } | 1609 } |
| 1628 | 1610 |
| 1629 /** | 1611 /** |
| 1630 * @override | 1612 * @override |
| 1631 */ | 1613 */ |
| 1632 onattach() { | 1614 onattach() { |
| 1633 super.onattach(); | 1615 super.onattach(); |
| 1634 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); | 1616 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); |
| 1635 } | 1617 } |
| 1636 | 1618 |
| 1637 _handleContextMenuEvent(event) { | 1619 _handleContextMenuEvent(event) { |
| 1638 var contextMenu = new UI.ContextMenu(event); | 1620 var contextMenu = new UI.ContextMenu(event); |
| 1639 contextMenu.appendItem(Common.UIString('Clear'), () => this._domStorage.clea r()); | 1621 contextMenu.appendItem(Common.UIString('Clear'), () => this._domStorage.clea r()); |
| 1640 contextMenu.show(); | 1622 contextMenu.show(); |
| 1641 } | 1623 } |
| 1642 }; | 1624 }; |
| 1643 | 1625 |
| 1644 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement { | 1626 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement { |
| 1645 /** | 1627 /** |
| 1646 * @param {!Resources.ResourcesPanel} storagePanel | 1628 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1647 * @param {!SDK.ResourceTreeFrame} frame | 1629 * @param {!SDK.ResourceTreeFrame} frame |
| 1648 * @param {string} cookieDomain | 1630 * @param {string} cookieDomain |
| 1649 */ | 1631 */ |
| 1650 constructor(storagePanel, frame, cookieDomain) { | 1632 constructor(storagePanel, frame, cookieDomain) { |
| 1651 super(storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Fil es'), false); | 1633 super(storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Fil es'), false); |
| 1652 this._target = frame.target(); | 1634 this._target = frame.target(); |
| 1653 this._cookieDomain = cookieDomain; | 1635 this._cookieDomain = cookieDomain; |
| 1654 var icon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); | 1636 var icon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); |
| 1655 this.setLeadingIcons([icon]); | 1637 this.setLeadingIcons([icon]); |
| 1656 } | 1638 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1716 this._storagePanel.showCategoryView(this._manifestURL); | 1698 this._storagePanel.showCategoryView(this._manifestURL); |
| 1717 return false; | 1699 return false; |
| 1718 } | 1700 } |
| 1719 }; | 1701 }; |
| 1720 | 1702 |
| 1721 /** | 1703 /** |
| 1722 * @unrestricted | 1704 * @unrestricted |
| 1723 */ | 1705 */ |
| 1724 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement { | 1706 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement { |
| 1725 /** | 1707 /** |
| 1726 * @param {!Resources.ResourcesPanel} storagePanel | 1708 * @param {!Resources.ApplicationPanelSidebar} storagePanel |
| 1727 * @param {!Protocol.Page.FrameId} frameId | 1709 * @param {!Protocol.Page.FrameId} frameId |
| 1728 * @param {string} manifestURL | 1710 * @param {string} manifestURL |
| 1729 */ | 1711 */ |
| 1730 constructor(storagePanel, frameId, manifestURL) { | 1712 constructor(storagePanel, frameId, manifestURL) { |
| 1731 super(storagePanel, '', false); | 1713 super(storagePanel, '', false); |
| 1732 this._frameId = frameId; | 1714 this._frameId = frameId; |
| 1733 this._manifestURL = manifestURL; | 1715 this._manifestURL = manifestURL; |
| 1734 this._refreshTitles(); | 1716 this._refreshTitles(); |
| 1735 | 1717 |
| 1736 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item '); | 1718 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item '); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1780 | 1762 |
| 1781 this.element.classList.add('storage-view'); | 1763 this.element.classList.add('storage-view'); |
| 1782 this._emptyWidget = new UI.EmptyWidget(''); | 1764 this._emptyWidget = new UI.EmptyWidget(''); |
| 1783 this._emptyWidget.show(this.element); | 1765 this._emptyWidget.show(this.element); |
| 1784 } | 1766 } |
| 1785 | 1767 |
| 1786 setText(text) { | 1768 setText(text) { |
| 1787 this._emptyWidget.text = text; | 1769 this._emptyWidget.text = text; |
| 1788 } | 1770 } |
| 1789 }; | 1771 }; |
| OLD | NEW |