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. |
| 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 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 * @extends {WebInspector.PanelWithSidebar} | 33 * @extends {WebInspector.PanelWithSidebar} |
| 34 * @implements {WebInspector.TargetManager.Observer} | 34 * @implements {WebInspector.TargetManager.Observer} |
| 35 */ | 35 */ |
| 36 WebInspector.ResourcesPanel = function() | 36 WebInspector.ResourcesPanel = function() |
| 37 { | 37 { |
| 38 WebInspector.PanelWithSidebar.call(this, "resources"); | 38 WebInspector.PanelWithSidebar.call(this, "resources"); |
| 39 this.registerRequiredCSS("resources/resourcesPanel.css"); | 39 this.registerRequiredCSS("resources/resourcesPanel.css"); |
| 40 | 40 |
| 41 this._resourcesLastSelectedItemSetting = WebInspector.settings.createSetting ("resourcesLastSelectedItem", {}); | 41 this._resourcesLastSelectedItemSetting = WebInspector.settings.createSetting ("resourcesLastSelectedItem", {}); |
| 42 | 42 |
| 43 this._sidebarTree = new TreeOutline(); | 43 this._sidebarTree = new TreeOutlineInShadow(); |
| 44 this._sidebarTree.element.classList.add("filter-all", "children", "small", " outline-disclosure"); | 44 this._sidebarTree.element.classList.add("resources-sidebar"); |
| 45 this._sidebarTree.registerRequiredCSS("resources/resourcesSidebar.css"); | |
| 46 this._sidebarTree.element.classList.add("filter-all", "outline-disclosure"); | |
| 45 this.panelSidebarElement().appendChild(this._sidebarTree.element); | 47 this.panelSidebarElement().appendChild(this._sidebarTree.element); |
| 46 this.setDefaultFocusedElement(this._sidebarTree.element); | 48 this.setDefaultFocusedElement(this._sidebarTree.element); |
| 47 | 49 |
| 48 this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement( this, WebInspector.UIString("Frames"), "Frames", ["frame-storage-tree-item"]); | 50 var storageTreeElement = new TreeElement(WebInspector.UIString("Storage"), t rue); |
| 49 this._sidebarTree.appendChild(this.resourcesListTreeElement); | 51 storageTreeElement.listItemElement.classList.add("storage-group-list-item"); |
| 52 storageTreeElement.setCollapsible(false); | |
| 53 storageTreeElement.selectable = false; | |
| 54 this._sidebarTree.appendChild(storageTreeElement); | |
| 55 | |
| 56 this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeEleme nt(this, WebInspector.UIString("Local Storage"), "LocalStorage", ["domstorage-st orage-tree-item", "local-storage"]); | |
| 57 storageTreeElement.appendChild(this.localStorageListTreeElement); | |
| 58 | |
| 59 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor age-storage-tree-item", "session-storage"]); | |
| 60 storageTreeElement.appendChild(this.sessionStorageListTreeElement); | |
| 61 | |
| 62 this.indexedDBListTreeElement = new WebInspector.IndexedDBTreeElement(this); | |
| 63 storageTreeElement.appendChild(this.indexedDBListTreeElement); | |
| 50 | 64 |
| 51 this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement( this, WebInspector.UIString("Web SQL"), "Databases", ["database-storage-tree-ite m"]); | 65 this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement( this, WebInspector.UIString("Web SQL"), "Databases", ["database-storage-tree-ite m"]); |
| 52 this._sidebarTree.appendChild(this.databasesListTreeElement); | 66 storageTreeElement.appendChild(this.databasesListTreeElement); |
| 53 | |
| 54 this.indexedDBListTreeElement = new WebInspector.IndexedDBTreeElement(this); | |
| 55 this._sidebarTree.appendChild(this.indexedDBListTreeElement); | |
| 56 | |
| 57 this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeEleme nt(this, WebInspector.UIString("Local Storage"), "LocalStorage", ["domstorage-st orage-tree-item", "local-storage"]); | |
| 58 this._sidebarTree.appendChild(this.localStorageListTreeElement); | |
| 59 | |
| 60 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor age-storage-tree-item", "session-storage"]); | |
| 61 this._sidebarTree.appendChild(this.sessionStorageListTreeElement); | |
| 62 | 67 |
| 63 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); | 68 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); |
| 64 this._sidebarTree.appendChild(this.cookieListTreeElement); | 69 storageTreeElement.appendChild(this.cookieListTreeElement); |
| 70 | |
| 71 var cacheTreeElement = new TreeElement(WebInspector.UIString("Cache"), true) ; | |
| 72 cacheTreeElement.listItemElement.classList.add("storage-group-list-item"); | |
| 73 cacheTreeElement.setCollapsible(false); | |
| 74 cacheTreeElement.selectable = false; | |
| 75 this._sidebarTree.appendChild(cacheTreeElement); | |
| 76 | |
| 77 this.cacheStorageListTreeElement = new WebInspector.ServiceWorkerCacheTreeEl ement(this); | |
| 78 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); | |
| 65 | 79 |
| 66 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a pplication-cache-storage-tree-item"]); | 80 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a pplication-cache-storage-tree-item"]); |
| 67 this._sidebarTree.appendChild(this.applicationCacheListTreeElement); | 81 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); |
| 68 | 82 |
| 69 this.cacheStorageListTreeElement = new WebInspector.ServiceWorkerCacheTreeEl ement(this); | 83 this.resourcesListTreeElement = new TreeElement(WebInspector.UIString("Frame s"), true); |
| 70 this._sidebarTree.appendChild(this.cacheStorageListTreeElement); | 84 this.resourcesListTreeElement.listItemElement.classList.add("storage-group-l ist-item"); |
| 85 this.resourcesListTreeElement.setCollapsible(false); | |
| 86 this.resourcesListTreeElement.selectable = false; | |
| 87 this._sidebarTree.appendChild(this.resourcesListTreeElement); | |
| 71 | 88 |
| 72 var mainContainer = new WebInspector.VBox(); | 89 var mainContainer = new WebInspector.VBox(); |
| 73 this.storageViews = mainContainer.element.createChild("div", "vbox flex-auto "); | 90 this.storageViews = mainContainer.element.createChild("div", "vbox flex-auto "); |
| 74 this._storageViewToolbar = new WebInspector.Toolbar("resources-toolbar", mai nContainer.element); | 91 this._storageViewToolbar = new WebInspector.Toolbar("resources-toolbar", mai nContainer.element); |
| 75 this.splitWidget().setMainWidget(mainContainer); | 92 this.splitWidget().setMainWidget(mainContainer); |
| 76 | 93 |
| 77 /** @type {!Map.<!WebInspector.Database, !Object.<string, !WebInspector.Data baseTableView>>} */ | 94 /** @type {!Map.<!WebInspector.Database, !Object.<string, !WebInspector.Data baseTableView>>} */ |
| 78 this._databaseTableViews = new Map(); | 95 this._databaseTableViews = new Map(); |
| 79 /** @type {!Map.<!WebInspector.Database, !WebInspector.DatabaseQueryView>} * / | 96 /** @type {!Map.<!WebInspector.Database, !WebInspector.DatabaseQueryView>} * / |
| 80 this._databaseQueryViews = new Map(); | 97 this._databaseQueryViews = new Map(); |
| 81 /** @type {!Map.<!WebInspector.Database, !WebInspector.DatabaseTreeElement>} */ | 98 /** @type {!Map.<!WebInspector.Database, !WebInspector.DatabaseTreeElement>} */ |
| 82 this._databaseTreeElements = new Map(); | 99 this._databaseTreeElements = new Map(); |
| 83 /** @type {!Map.<!WebInspector.DOMStorage, !WebInspector.DOMStorageItemsView >} */ | 100 /** @type {!Map.<!WebInspector.DOMStorage, !WebInspector.DOMStorageItemsView >} */ |
| 84 this._domStorageViews = new Map(); | 101 this._domStorageViews = new Map(); |
| 85 /** @type {!Map.<!WebInspector.DOMStorage, !WebInspector.DOMStorageTreeEleme nt>} */ | 102 /** @type {!Map.<!WebInspector.DOMStorage, !WebInspector.DOMStorageTreeEleme nt>} */ |
| 86 this._domStorageTreeElements = new Map(); | 103 this._domStorageTreeElements = new Map(); |
| 87 /** @type {!Object.<string, !WebInspector.CookieItemsView>} */ | 104 /** @type {!Object.<string, !WebInspector.CookieItemsView>} */ |
| 88 this._cookieViews = {}; | 105 this._cookieViews = {}; |
| 89 /** @type {!Object.<string, boolean>} */ | 106 /** @type {!Object.<string, boolean>} */ |
| 90 this._domains = {}; | 107 this._domains = {}; |
| 91 | 108 |
| 92 this.panelSidebarElement().addEventListener("mousemove", this._onmousemove.b ind(this), false); | 109 this.panelSidebarElement().addEventListener("mousemove", this._onmousemove.b ind(this), false); |
| 93 this.panelSidebarElement().addEventListener("mouseleave", this._onmouseleave .bind(this), false); | 110 this.panelSidebarElement().addEventListener("mouseleave", this._onmouseleave .bind(this), false); |
| 94 | 111 |
| 95 WebInspector.targetManager.observeTargets(this); | 112 WebInspector.targetManager.observeTargets(this); |
| 96 } | 113 } |
| 97 | 114 |
| 98 WebInspector.ResourcesPanel.prototype = { | 115 WebInspector.ResourcesPanel.prototype = { |
| 116 wasShown: function() | |
| 117 { | |
| 118 if (!this._sidebarTree.selectedTreeElement) { | |
| 119 if (this.serviceWorkersTreeElement) | |
| 120 this.serviceWorkersTreeElement.select(); | |
| 121 else | |
| 122 this.localStorageListTreeElement.select(); | |
| 123 } | |
| 124 }, | |
| 125 | |
| 99 /** | 126 /** |
| 100 * @override | 127 * @override |
| 101 * @param {!WebInspector.Target} target | 128 * @param {!WebInspector.Target} target |
| 102 */ | 129 */ |
| 103 targetAdded: function(target) | 130 targetAdded: function(target) |
| 104 { | 131 { |
| 105 if (this._target) | 132 if (this._target) |
| 106 return; | 133 return; |
| 107 this._target = target; | 134 this._target = target; |
| 108 | 135 |
| 109 if (target.serviceWorkerManager) { | 136 if (target.serviceWorkerManager) { |
| 110 this.serviceWorkersTreeElement = new WebInspector.ServiceWorkersTree Element(this); | 137 this.serviceWorkersTreeElement = new WebInspector.ServiceWorkersTree Element(this); |
| 111 this._sidebarTree.appendChild(this.serviceWorkersTreeElement); | 138 this._sidebarTree.insertChild(this.serviceWorkersTreeElement, 0); |
| 112 } | 139 } |
| 113 | 140 |
| 114 this._databaseModel = WebInspector.DatabaseModel.fromTarget(target); | 141 this._databaseModel = WebInspector.DatabaseModel.fromTarget(target); |
| 115 this._domStorageModel = WebInspector.DOMStorageModel.fromTarget(target); | 142 this._domStorageModel = WebInspector.DOMStorageModel.fromTarget(target); |
| 116 | 143 |
| 117 if (target.resourceTreeModel.cachedResourcesLoaded()) | 144 if (target.resourceTreeModel.cachedResourcesLoaded()) |
| 118 this._initialize(); | 145 this._initialize(); |
| 119 | 146 |
| 120 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel .EventTypes.Load, this._loadEventFired, this); | 147 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel .EventTypes.Load, this._loadEventFired, this); |
| 121 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel .EventTypes.CachedResourcesLoaded, this._initialize, this); | 148 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel .EventTypes.CachedResourcesLoaded, this._initialize, this); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 this._databaseTreeElements.set(database, databaseTreeElement); | 359 this._databaseTreeElements.set(database, databaseTreeElement); |
| 333 this.databasesListTreeElement.appendChild(databaseTreeElement); | 360 this.databasesListTreeElement.appendChild(databaseTreeElement); |
| 334 }, | 361 }, |
| 335 | 362 |
| 336 addDocumentURL: function(url) | 363 addDocumentURL: function(url) |
| 337 { | 364 { |
| 338 var parsedURL = url.asParsedURL(); | 365 var parsedURL = url.asParsedURL(); |
| 339 if (!parsedURL) | 366 if (!parsedURL) |
| 340 return; | 367 return; |
| 341 | 368 |
| 342 var domain = parsedURL.host; | 369 var domain = parsedURL.securityOrigin(); |
| 343 if (!this._domains[domain]) { | 370 if (!this._domains[domain]) { |
| 344 this._domains[domain] = true; | 371 this._domains[domain] = true; |
| 345 | 372 |
| 346 var cookieDomainTreeElement = new WebInspector.CookieTreeElement(thi s, domain); | 373 var cookieDomainTreeElement = new WebInspector.CookieTreeElement(thi s, domain); |
| 347 this.cookieListTreeElement.appendChild(cookieDomainTreeElement); | 374 this.cookieListTreeElement.appendChild(cookieDomainTreeElement); |
| 348 } | 375 } |
| 349 }, | 376 }, |
| 350 | 377 |
| 351 /** | 378 /** |
| 352 * @param {!WebInspector.Event} event | 379 * @param {!WebInspector.Event} event |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 * @constructor | 849 * @constructor |
| 823 * @extends {TreeElement} | 850 * @extends {TreeElement} |
| 824 * @param {!WebInspector.ResourcesPanel} storagePanel | 851 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 825 * @param {string} title | 852 * @param {string} title |
| 826 * @param {?Array.<string>=} iconClasses | 853 * @param {?Array.<string>=} iconClasses |
| 827 * @param {boolean=} expandable | 854 * @param {boolean=} expandable |
| 828 * @param {boolean=} noIcon | 855 * @param {boolean=} noIcon |
| 829 */ | 856 */ |
| 830 WebInspector.BaseStorageTreeElement = function(storagePanel, title, iconClasses, expandable, noIcon) | 857 WebInspector.BaseStorageTreeElement = function(storagePanel, title, iconClasses, expandable, noIcon) |
| 831 { | 858 { |
| 832 TreeElement.call(this, "", expandable); | 859 TreeElement.call(this, title, expandable); |
| 833 this._storagePanel = storagePanel; | 860 this._storagePanel = storagePanel; |
| 834 this._titleText = title; | 861 for (var i = 0; iconClasses && i < iconClasses.length; ++i) |
| 862 this.listItemElement.classList.add(iconClasses[i]); | |
| 863 | |
| 835 this._iconClasses = iconClasses; | 864 this._iconClasses = iconClasses; |
| 836 this._noIcon = noIcon; | 865 if (!noIcon) |
| 866 this.createIcon(); | |
| 837 } | 867 } |
| 838 | 868 |
| 839 WebInspector.BaseStorageTreeElement.prototype = { | 869 WebInspector.BaseStorageTreeElement.prototype = { |
| 840 onattach: function() | |
| 841 { | |
| 842 this.listItemElement.removeChildren(); | |
| 843 if (this._iconClasses) { | |
| 844 for (var i = 0; i < this._iconClasses.length; ++i) | |
| 845 this.listItemElement.classList.add(this._iconClasses[i]); | |
| 846 } | |
| 847 | |
| 848 this.listItemElement.createChild("div", "selection fill"); | |
| 849 | |
| 850 if (!this._noIcon) | |
| 851 this.imageElement = this.listItemElement.createChild("img", "icon"); | |
| 852 | |
| 853 this.titleElement = this.listItemElement.createChild("div", "base-storag e-tree-element-title"); | |
| 854 this._titleTextNode = this.titleElement.createTextChild(""); | |
| 855 this._updateTitle(); | |
| 856 this._updateSubtitle(); | |
| 857 }, | |
| 858 | |
| 859 get displayName() | |
| 860 { | |
| 861 return this._displayName; | |
| 862 }, | |
| 863 | |
| 864 _updateDisplayName: function() | |
| 865 { | |
| 866 this._displayName = this._titleText || ""; | |
| 867 if (this._subtitleText) | |
| 868 this._displayName += " (" + this._subtitleText + ")"; | |
| 869 }, | |
| 870 | |
| 871 _updateTitle: function() | |
| 872 { | |
| 873 this._updateDisplayName(); | |
| 874 | |
| 875 if (!this.titleElement) | |
| 876 return; | |
| 877 | |
| 878 this._titleTextNode.textContent = this._titleText || ""; | |
| 879 }, | |
| 880 | |
| 881 _updateSubtitle: function() | |
| 882 { | |
| 883 this._updateDisplayName(); | |
| 884 | |
| 885 if (!this.titleElement) | |
| 886 return; | |
| 887 | |
| 888 if (this._subtitleText) { | |
| 889 if (!this._subtitleElement) | |
| 890 this._subtitleElement = this.titleElement.createChild("span", "b ase-storage-tree-element-subtitle"); | |
| 891 this._subtitleElement.textContent = "(" + this._subtitleText + ")"; | |
| 892 } else if (this._subtitleElement) { | |
| 893 this._subtitleElement.remove(); | |
| 894 delete this._subtitleElement; | |
| 895 } | |
| 896 }, | |
| 897 | |
| 898 /** | 870 /** |
| 899 * @override | 871 * @override |
| 900 * @return {boolean} | 872 * @return {boolean} |
| 901 */ | 873 */ |
| 902 onselect: function(selectedByUser) | 874 onselect: function(selectedByUser) |
| 903 { | 875 { |
| 904 if (!selectedByUser) | 876 if (!selectedByUser) |
| 905 return false; | 877 return false; |
| 906 var itemURL = this.itemURL; | 878 var itemURL = this.itemURL; |
| 907 if (itemURL) | 879 if (itemURL) |
| 908 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL); | 880 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL); |
| 909 return false; | 881 return false; |
| 910 }, | 882 }, |
| 911 | 883 |
| 912 get titleText() | |
| 913 { | |
| 914 return this._titleText; | |
| 915 }, | |
| 916 | |
| 917 set titleText(titleText) | |
| 918 { | |
| 919 this._titleText = titleText; | |
| 920 this._updateTitle(); | |
| 921 }, | |
| 922 | |
| 923 get subtitleText() | |
| 924 { | |
| 925 return this._subtitleText; | |
| 926 }, | |
| 927 | |
| 928 set subtitleText(subtitleText) | |
| 929 { | |
| 930 this._subtitleText = subtitleText; | |
| 931 this._updateSubtitle(); | |
| 932 }, | |
| 933 | |
| 934 __proto__: TreeElement.prototype | 884 __proto__: TreeElement.prototype |
| 935 } | 885 } |
| 936 | 886 |
| 937 /** | 887 /** |
| 938 * @constructor | 888 * @constructor |
| 939 * @extends {WebInspector.BaseStorageTreeElement} | 889 * @extends {WebInspector.BaseStorageTreeElement} |
| 940 * @param {!WebInspector.ResourcesPanel} storagePanel | 890 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 941 * @param {string} categoryName | 891 * @param {string} categoryName |
| 942 * @param {string} settingsKey | 892 * @param {string} settingsKey |
| 943 * @param {?Array.<string>=} iconClasses | 893 * @param {?Array.<string>=} iconClasses |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 } | 955 } |
| 1006 | 956 |
| 1007 /** | 957 /** |
| 1008 * @constructor | 958 * @constructor |
| 1009 * @extends {WebInspector.BaseStorageTreeElement} | 959 * @extends {WebInspector.BaseStorageTreeElement} |
| 1010 * @param {!WebInspector.ResourcesPanel} storagePanel | 960 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1011 * @param {!WebInspector.ResourceTreeFrame} frame | 961 * @param {!WebInspector.ResourceTreeFrame} frame |
| 1012 */ | 962 */ |
| 1013 WebInspector.FrameTreeElement = function(storagePanel, frame) | 963 WebInspector.FrameTreeElement = function(storagePanel, frame) |
| 1014 { | 964 { |
| 1015 WebInspector.BaseStorageTreeElement.call(this, storagePanel, "", ["frame-sto rage-tree-item"]); | 965 WebInspector.BaseStorageTreeElement.call(this, storagePanel, "", ["navigator -tree-item", "navigator-folder-tree-item"]); |
| 1016 this._frame = frame; | 966 this._frame = frame; |
| 1017 this.frameNavigated(frame); | 967 this.frameNavigated(frame); |
| 1018 } | 968 } |
| 1019 | 969 |
| 1020 WebInspector.FrameTreeElement.prototype = { | 970 WebInspector.FrameTreeElement.prototype = { |
| 1021 frameNavigated: function(frame) | 971 frameNavigated: function(frame) |
| 1022 { | 972 { |
| 1023 this.removeChildren(); | 973 this.removeChildren(); |
| 1024 this._frameId = frame.id; | 974 this._frameId = frame.id; |
| 1025 | 975 this.title = frame.displayName(); |
| 1026 this.titleText = frame.name; | |
| 1027 this.subtitleText = new WebInspector.ParsedURL(frame.url).displayName; | |
| 1028 | |
| 1029 this._categoryElements = {}; | 976 this._categoryElements = {}; |
| 1030 this._treeElementForResource = {}; | 977 this._treeElementForResource = {}; |
| 1031 | 978 |
| 1032 this._storagePanel.addDocumentURL(frame.url); | 979 this._storagePanel.addDocumentURL(frame.url); |
| 1033 }, | 980 }, |
| 1034 | 981 |
| 1035 get itemURL() | 982 get itemURL() |
| 1036 { | 983 { |
| 1037 return "frame://" + encodeURI(this.displayName); | 984 return "frame://" + encodeURI(this.titleAsText()); |
| 1038 }, | 985 }, |
| 1039 | 986 |
| 1040 /** | 987 /** |
| 1041 * @override | 988 * @override |
| 1042 * @return {boolean} | 989 * @return {boolean} |
| 1043 */ | 990 */ |
| 1044 onselect: function(selectedByUser) | 991 onselect: function(selectedByUser) |
| 1045 { | 992 { |
| 1046 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select edByUser); | 993 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select edByUser); |
| 1047 this._storagePanel.showCategoryView(this.displayName); | 994 this._storagePanel.showCategoryView(this.titleAsText()); |
| 1048 | 995 |
| 1049 this.listItemElement.classList.remove("hovered"); | 996 this.listItemElement.classList.remove("hovered"); |
| 1050 WebInspector.DOMModel.hideDOMNodeHighlight(); | 997 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 1051 return false; | 998 return false; |
| 1052 }, | 999 }, |
| 1053 | 1000 |
| 1054 set hovered(hovered) | 1001 set hovered(hovered) |
| 1055 { | 1002 { |
| 1056 if (hovered) { | 1003 if (hovered) { |
| 1057 this.listItemElement.classList.add("hovered"); | 1004 this.listItemElement.classList.add("hovered"); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 function compare(treeElement1, treeElement2) | 1061 function compare(treeElement1, treeElement2) |
| 1115 { | 1062 { |
| 1116 var typeWeight1 = typeWeight(treeElement1); | 1063 var typeWeight1 = typeWeight(treeElement1); |
| 1117 var typeWeight2 = typeWeight(treeElement2); | 1064 var typeWeight2 = typeWeight(treeElement2); |
| 1118 | 1065 |
| 1119 var result; | 1066 var result; |
| 1120 if (typeWeight1 > typeWeight2) | 1067 if (typeWeight1 > typeWeight2) |
| 1121 result = 1; | 1068 result = 1; |
| 1122 else if (typeWeight1 < typeWeight2) | 1069 else if (typeWeight1 < typeWeight2) |
| 1123 result = -1; | 1070 result = -1; |
| 1124 else { | 1071 else |
| 1125 var title1 = treeElement1.displayName || treeElement1.titleText; | 1072 result = treeElement1.titleAsText().localeCompare(treeElement2.t itleAsText()); |
| 1126 var title2 = treeElement2.displayName || treeElement2.titleText; | |
| 1127 result = title1.localeCompare(title2); | |
| 1128 } | |
| 1129 return result; | 1073 return result; |
| 1130 } | 1074 } |
| 1131 | 1075 |
| 1132 var childCount = parentTreeElement.childCount(); | 1076 var childCount = parentTreeElement.childCount(); |
| 1133 var i; | 1077 var i; |
| 1134 for (i = 0; i < childCount; ++i) { | 1078 for (i = 0; i < childCount; ++i) { |
| 1135 if (compare(childTreeElement, parentTreeElement.childAt(i)) < 0) | 1079 if (compare(childTreeElement, parentTreeElement.childAt(i)) < 0) |
| 1136 break; | 1080 break; |
| 1137 } | 1081 } |
| 1138 parentTreeElement.insertChild(childTreeElement, i); | 1082 parentTreeElement.insertChild(childTreeElement, i); |
| 1139 }, | 1083 }, |
| 1140 | 1084 |
| 1141 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1085 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 1142 } | 1086 } |
| 1143 | 1087 |
| 1144 /** | 1088 /** |
| 1145 * @constructor | 1089 * @constructor |
| 1146 * @extends {WebInspector.BaseStorageTreeElement} | 1090 * @extends {WebInspector.BaseStorageTreeElement} |
| 1147 * @param {!WebInspector.ResourcesPanel} storagePanel | 1091 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1148 * @param {!WebInspector.Resource} resource | 1092 * @param {!WebInspector.Resource} resource |
| 1149 */ | 1093 */ |
| 1150 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) | 1094 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) |
| 1151 { | 1095 { |
| 1152 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displa yName, ["resource-sidebar-tree-item", "resources-type-" + resource.resourceType( ).name()]); | 1096 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displa yName, ["navigator-tree-item", "navigator-file-tree-item", "navigator-" + resour ce.resourceType().name() + "-tree-item"]); |
| 1153 /** @type {!WebInspector.Resource} */ | 1097 /** @type {!WebInspector.Resource} */ |
| 1154 this._resource = resource; | 1098 this._resource = resource; |
| 1155 this.tooltip = resource.url; | 1099 this.tooltip = resource.url; |
| 1156 this._resource[WebInspector.FrameResourceTreeElement._symbol] = this; | 1100 this._resource[WebInspector.FrameResourceTreeElement._symbol] = this; |
| 1157 } | 1101 } |
| 1158 | 1102 |
| 1159 WebInspector.FrameResourceTreeElement._symbol = Symbol("treeElement"); | 1103 WebInspector.FrameResourceTreeElement._symbol = Symbol("treeElement"); |
| 1160 | 1104 |
| 1161 WebInspector.FrameResourceTreeElement.prototype = { | 1105 WebInspector.FrameResourceTreeElement.prototype = { |
| 1162 get itemURL() | 1106 get itemURL() |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1184 InspectorFrontendHost.openInNewTab(this._resource.url); | 1128 InspectorFrontendHost.openInNewTab(this._resource.url); |
| 1185 return false; | 1129 return false; |
| 1186 }, | 1130 }, |
| 1187 | 1131 |
| 1188 /** | 1132 /** |
| 1189 * @override | 1133 * @override |
| 1190 */ | 1134 */ |
| 1191 onattach: function() | 1135 onattach: function() |
| 1192 { | 1136 { |
| 1193 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); | 1137 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); |
| 1194 | |
| 1195 if (this._resource.resourceType() === WebInspector.resourceTypes.Image) { | |
| 1196 var iconElement = createElementWithClass("div", "icon"); | |
| 1197 var previewImage = iconElement.createChild("img", "image-resource-ic on-preview"); | |
| 1198 this._resource.populateImageSource(previewImage); | |
| 1199 this.listItemElement.replaceChild(iconElement, this.imageElement); | |
| 1200 } | |
| 1201 | |
| 1202 this._statusElement = createElementWithClass("div", "status"); | |
| 1203 this.listItemElement.insertBefore(this._statusElement, this.titleElement ); | |
| 1204 | |
| 1205 this.listItemElement.draggable = true; | 1138 this.listItemElement.draggable = true; |
| 1206 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin d(this), false); | 1139 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin d(this), false); |
| 1207 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); | 1140 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); |
| 1208 }, | 1141 }, |
| 1209 | 1142 |
| 1210 /** | 1143 /** |
| 1211 * @param {!MouseEvent} event | 1144 * @param {!MouseEvent} event |
| 1212 * @return {boolean} | 1145 * @return {boolean} |
| 1213 */ | 1146 */ |
| 1214 _ondragstart: function(event) | 1147 _ondragstart: function(event) |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1511 } | 1444 } |
| 1512 | 1445 |
| 1513 | 1446 |
| 1514 /** | 1447 /** |
| 1515 * @constructor | 1448 * @constructor |
| 1516 * @extends {WebInspector.BaseStorageTreeElement} | 1449 * @extends {WebInspector.BaseStorageTreeElement} |
| 1517 * @param {!WebInspector.ResourcesPanel} storagePanel | 1450 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1518 */ | 1451 */ |
| 1519 WebInspector.ServiceWorkersTreeElement = function(storagePanel) | 1452 WebInspector.ServiceWorkersTreeElement = function(storagePanel) |
| 1520 { | 1453 { |
| 1521 WebInspector.BaseStorageTreeElement.call(this, storagePanel, "Service Worker s", ["service-workers-tree-item"], false); | 1454 WebInspector.BaseStorageTreeElement.call(this, storagePanel, WebInspector.UI String("Service Workers"), ["service-workers-tree-item"], false); |
| 1522 } | 1455 } |
| 1523 | 1456 |
| 1524 WebInspector.ServiceWorkersTreeElement.prototype = { | 1457 WebInspector.ServiceWorkersTreeElement.prototype = { |
| 1525 /** | 1458 /** |
| 1526 * @return {string} | 1459 * @return {string} |
| 1527 */ | 1460 */ |
| 1528 get itemURL() | 1461 get itemURL() |
| 1529 { | 1462 { |
| 1530 return "service-workers://"; | 1463 return "service-workers://"; |
| 1531 }, | 1464 }, |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2102 | 2035 |
| 2103 /** | 2036 /** |
| 2104 * @constructor | 2037 * @constructor |
| 2105 * @extends {WebInspector.BaseStorageTreeElement} | 2038 * @extends {WebInspector.BaseStorageTreeElement} |
| 2106 * @param {!WebInspector.ResourcesPanel} storagePanel | 2039 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 2107 * @param {!PageAgent.FrameId} frameId | 2040 * @param {!PageAgent.FrameId} frameId |
| 2108 * @param {string} manifestURL | 2041 * @param {string} manifestURL |
| 2109 */ | 2042 */ |
| 2110 WebInspector.ApplicationCacheFrameTreeElement = function(storagePanel, frameId, manifestURL) | 2043 WebInspector.ApplicationCacheFrameTreeElement = function(storagePanel, frameId, manifestURL) |
| 2111 { | 2044 { |
| 2112 WebInspector.BaseStorageTreeElement.call(this, storagePanel, "", ["frame-sto rage-tree-item"]); | 2045 WebInspector.BaseStorageTreeElement.call(this, storagePanel, "", ["navigator -tree-item", "navigator-folder-tree-item"]); |
| 2113 this._frameId = frameId; | 2046 this._frameId = frameId; |
| 2114 this._manifestURL = manifestURL; | 2047 this._manifestURL = manifestURL; |
| 2115 this._refreshTitles(); | 2048 this._refreshTitles(); |
| 2116 } | 2049 } |
| 2117 | 2050 |
| 2118 WebInspector.ApplicationCacheFrameTreeElement.prototype = { | 2051 WebInspector.ApplicationCacheFrameTreeElement.prototype = { |
| 2119 get itemURL() | 2052 get itemURL() |
| 2120 { | 2053 { |
| 2121 return "appcache://" + this._manifestURL + "/" + encodeURI(this.displayN ame); | 2054 return "appcache://" + this._manifestURL + "/" + encodeURI(this.titleAsT ext()); |
|
dgozman
2016/04/28 01:44:58
It's strange to use titleAsText as a part of URL,
| |
| 2122 }, | 2055 }, |
| 2123 | 2056 |
| 2124 get frameId() | 2057 get frameId() |
| 2125 { | 2058 { |
| 2126 return this._frameId; | 2059 return this._frameId; |
| 2127 }, | 2060 }, |
| 2128 | 2061 |
| 2129 get manifestURL() | 2062 get manifestURL() |
| 2130 { | 2063 { |
| 2131 return this._manifestURL; | 2064 return this._manifestURL; |
| 2132 }, | 2065 }, |
| 2133 | 2066 |
| 2134 _refreshTitles: function() | 2067 _refreshTitles: function() |
| 2135 { | 2068 { |
| 2136 var frame = this._storagePanel._target.resourceTreeModel.frameForId(this ._frameId); | 2069 var frame = this._storagePanel._target.resourceTreeModel.frameForId(this ._frameId); |
| 2137 if (!frame) { | 2070 this.title = frame.displayName(); |
| 2138 this.subtitleText = WebInspector.UIString("new frame"); | |
| 2139 return; | |
| 2140 } | |
| 2141 this.titleText = frame.name; | |
| 2142 this.subtitleText = new WebInspector.ParsedURL(frame.url).displayName; | |
| 2143 }, | 2071 }, |
| 2144 | 2072 |
| 2145 frameNavigated: function() | 2073 frameNavigated: function() |
| 2146 { | 2074 { |
| 2147 this._refreshTitles(); | 2075 this._refreshTitles(); |
| 2148 }, | 2076 }, |
| 2149 | 2077 |
| 2150 /** | 2078 /** |
| 2151 * @override | 2079 * @override |
| 2152 * @return {boolean} | 2080 * @return {boolean} |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2217 WebInspector.ResourcesPanelFactory.prototype = { | 2145 WebInspector.ResourcesPanelFactory.prototype = { |
| 2218 /** | 2146 /** |
| 2219 * @override | 2147 * @override |
| 2220 * @return {!WebInspector.Panel} | 2148 * @return {!WebInspector.Panel} |
| 2221 */ | 2149 */ |
| 2222 createPanel: function() | 2150 createPanel: function() |
| 2223 { | 2151 { |
| 2224 return WebInspector.ResourcesPanel._instance(); | 2152 return WebInspector.ResourcesPanel._instance(); |
| 2225 } | 2153 } |
| 2226 } | 2154 } |
| OLD | NEW |