Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js

Issue 2660893002: DevTools: migrate ResourcesPanel icons over to UI.Icon (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication')); 47 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication'));
48 this._manifestTreeElement = new Resources.AppManifestTreeElement(this); 48 this._manifestTreeElement = new Resources.AppManifestTreeElement(this);
49 this._applicationTreeElement.appendChild(this._manifestTreeElement); 49 this._applicationTreeElement.appendChild(this._manifestTreeElement);
50 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(thi s); 50 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(thi s);
51 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); 51 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement);
52 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(this); 52 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(this);
53 this._applicationTreeElement.appendChild(clearStorageTreeElement); 53 this._applicationTreeElement.appendChild(clearStorageTreeElement);
54 54
55 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage')) ; 55 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage')) ;
56 this.localStorageListTreeElement = new Resources.StorageCategoryTreeElement( 56 this.localStorageListTreeElement =
57 this, Common.UIString('Local Storage'), 'LocalStorage', ['table-tree-ite m', 'resource-tree-item']); 57 new Resources.StorageCategoryTreeElement(this, Common.UIString('Local St orage'), 'LocalStorage');
lushnikov 2017/01/30 12:50:36 note: the StorageCategoryTreeElement doesn't accep
58 var localStorageIcon = UI.Icon.create('resourceicon-table', 'resource-tree-i tem');
59 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]);
60
58 storageTreeElement.appendChild(this.localStorageListTreeElement); 61 storageTreeElement.appendChild(this.localStorageListTreeElement);
59 this.sessionStorageListTreeElement = new Resources.StorageCategoryTreeElemen t( 62 this.sessionStorageListTreeElement =
60 this, Common.UIString('Session Storage'), 'SessionStorage', ['table-tree -item', 'resource-tree-item']); 63 new Resources.StorageCategoryTreeElement(this, Common.UIString('Session Storage'), 'SessionStorage');
64 var sessionStorageIcon = UI.Icon.create('resourceicon-table', 'resource-tree -item');
65 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]);
66
61 storageTreeElement.appendChild(this.sessionStorageListTreeElement); 67 storageTreeElement.appendChild(this.sessionStorageListTreeElement);
62 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(this); 68 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(this);
63 storageTreeElement.appendChild(this.indexedDBListTreeElement); 69 storageTreeElement.appendChild(this.indexedDBListTreeElement);
64 this.databasesListTreeElement = new Resources.StorageCategoryTreeElement( 70 this.databasesListTreeElement =
65 this, Common.UIString('Web SQL'), 'Databases', ['database-tree-item', 'r esource-tree-item']); 71 new Resources.StorageCategoryTreeElement(this, Common.UIString('Web SQL' ), 'Databases');
72 var databaseIcon = UI.Icon.create('resourceicon-database', 'resource-tree-it em');
73 this.databasesListTreeElement.setLeadingIcons([databaseIcon]);
74
66 storageTreeElement.appendChild(this.databasesListTreeElement); 75 storageTreeElement.appendChild(this.databasesListTreeElement);
67 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement( 76 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(this, Common.UIString('Cookies'), 'Cookies');
68 this, Common.UIString('Cookies'), 'Cookies', ['cookie-tree-item', 'resou rce-tree-item']); 77 var cookieIcon = UI.Icon.create('resourceicon-cookie', 'resource-tree-item') ;
78 this.cookieListTreeElement.setLeadingIcons([cookieIcon]);
69 storageTreeElement.appendChild(this.cookieListTreeElement); 79 storageTreeElement.appendChild(this.cookieListTreeElement);
70 80
71 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); 81 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache'));
72 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme nt(this); 82 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme nt(this);
73 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); 83 cacheTreeElement.appendChild(this.cacheStorageListTreeElement);
74 this.applicationCacheListTreeElement = new Resources.StorageCategoryTreeElem ent( 84 this.applicationCacheListTreeElement =
75 this, Common.UIString('Application Cache'), 'ApplicationCache', 85 new Resources.StorageCategoryTreeElement(this, Common.UIString('Applicat ion Cache'), 'ApplicationCache');
76 ['appcache-tree-item', 'table-tree-item', 'resource-tree-item']); 86 var applicationCacheIcon = UI.Icon.create('resourceicon-table', 'resource-tr ee-item');
87 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon]) ;
88
77 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); 89 cacheTreeElement.appendChild(this.applicationCacheListTreeElement);
78 90
79 this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Fra mes')); 91 this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Fra mes'));
80 92
81 var mainContainer = new UI.VBox(); 93 var mainContainer = new UI.VBox();
82 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element); 94 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element);
83 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto '); 95 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto ');
84 this.splitWidget().setMainWidget(mainContainer); 96 this.splitWidget().setMainWidget(mainContainer);
85 97
86 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */ 98 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 842 }
831 }; 843 };
832 844
833 /** 845 /**
834 * @unrestricted 846 * @unrestricted
835 */ 847 */
836 Resources.BaseStorageTreeElement = class extends UI.TreeElement { 848 Resources.BaseStorageTreeElement = class extends UI.TreeElement {
837 /** 849 /**
838 * @param {!Resources.ResourcesPanel} storagePanel 850 * @param {!Resources.ResourcesPanel} storagePanel
839 * @param {string} title 851 * @param {string} title
840 * @param {?Array.<string>=} iconClasses 852 * @param {boolean} expandable
841 * @param {boolean=} expandable
842 * @param {boolean=} noIcon
843 */ 853 */
844 constructor(storagePanel, title, iconClasses, expandable, noIcon) { 854 constructor(storagePanel, title, expandable) {
845 super(title, expandable); 855 super(title, expandable);
846 this._storagePanel = storagePanel; 856 this._storagePanel = storagePanel;
847 for (var i = 0; iconClasses && i < iconClasses.length; ++i)
848 this.listItemElement.classList.add(iconClasses[i]);
849
850 this._iconClasses = iconClasses;
851 if (!noIcon)
852 this.createIcon();
853 } 857 }
854 858
855 /** 859 /**
856 * @override 860 * @override
857 * @return {boolean} 861 * @return {boolean}
858 */ 862 */
859 onselect(selectedByUser) { 863 onselect(selectedByUser) {
860 if (!selectedByUser) 864 if (!selectedByUser)
861 return false; 865 return false;
862 var itemURL = this.itemURL; 866 var itemURL = this.itemURL;
863 if (itemURL) 867 if (itemURL)
864 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL); 868 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL);
865 return false; 869 return false;
866 } 870 }
867 }; 871 };
868 872
869 /** 873 /**
870 * @unrestricted 874 * @unrestricted
871 */ 875 */
872 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl ement { 876 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl ement {
873 /** 877 /**
874 * @param {!Resources.ResourcesPanel} storagePanel 878 * @param {!Resources.ResourcesPanel} storagePanel
875 * @param {string} categoryName 879 * @param {string} categoryName
876 * @param {string} settingsKey 880 * @param {string} settingsKey
877 * @param {?Array.<string>=} iconClasses
878 * @param {boolean=} noIcon
879 */ 881 */
880 constructor(storagePanel, categoryName, settingsKey, iconClasses, noIcon) { 882 constructor(storagePanel, categoryName, settingsKey) {
881 super(storagePanel, categoryName, iconClasses, false, noIcon); 883 super(storagePanel, categoryName, false);
882 this._expandedSetting = 884 this._expandedSetting =
883 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se ttingsKey === 'Frames'); 885 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se ttingsKey === 'Frames');
884 this._categoryName = categoryName; 886 this._categoryName = categoryName;
885 } 887 }
886 888
887 /** 889 /**
888 * @return {!SDK.Target} 890 * @return {!SDK.Target}
889 */ 891 */
890 target() { 892 target() {
891 return this._storagePanel._target; 893 return this._storagePanel._target;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 933
932 /** 934 /**
933 * @unrestricted 935 * @unrestricted
934 */ 936 */
935 Resources.FrameTreeElement = class extends Resources.BaseStorageTreeElement { 937 Resources.FrameTreeElement = class extends Resources.BaseStorageTreeElement {
936 /** 938 /**
937 * @param {!Resources.ResourcesPanel} storagePanel 939 * @param {!Resources.ResourcesPanel} storagePanel
938 * @param {!SDK.ResourceTreeFrame} frame 940 * @param {!SDK.ResourceTreeFrame} frame
939 */ 941 */
940 constructor(storagePanel, frame) { 942 constructor(storagePanel, frame) {
941 super(storagePanel, '', ['navigator-tree-item', 'navigator-frame-tree-item'] ); 943 super(storagePanel, '', false);
lushnikov 2017/01/30 12:50:36 started explicitly passing the "expandable" argume
942 this._frame = frame; 944 this._frame = frame;
943 this.frameNavigated(frame); 945 this.frameNavigated(frame);
946
947 var icon = UI.Icon.create('largeicon-navigator-frame', 'navigator-tree-item' );
948 icon.classList.add('navigator-frame-tree-item');
949 this.setLeadingIcons([icon]);
944 } 950 }
945 951
946 frameNavigated(frame) { 952 frameNavigated(frame) {
947 this.removeChildren(); 953 this.removeChildren();
948 this._frameId = frame.id; 954 this._frameId = frame.id;
949 this.title = frame.displayName(); 955 this.title = frame.displayName();
950 this._categoryElements = {}; 956 this._categoryElements = {};
951 this._treeElementForResource = {}; 957 this._treeElementForResource = {};
952 958
953 this._storagePanel.addCookieDocument(frame); 959 this._storagePanel.addCookieDocument(frame);
(...skipping 30 matching lines...) Expand all
984 990
985 /** 991 /**
986 * @param {!SDK.Resource} resource 992 * @param {!SDK.Resource} resource
987 */ 993 */
988 appendResource(resource) { 994 appendResource(resource) {
989 var resourceType = resource.resourceType(); 995 var resourceType = resource.resourceType();
990 var categoryName = resourceType.name(); 996 var categoryName = resourceType.name();
991 var categoryElement = resourceType === Common.resourceTypes.Document ? this : this._categoryElements[categoryName]; 997 var categoryElement = resourceType === Common.resourceTypes.Document ? this : this._categoryElements[categoryName];
992 if (!categoryElement) { 998 if (!categoryElement) {
993 categoryElement = new Resources.StorageCategoryTreeElement( 999 categoryElement = new Resources.StorageCategoryTreeElement(
994 this._storagePanel, resource.resourceType().category().title, category Name, null, true); 1000 this._storagePanel, resource.resourceType().category().title, category Name);
lushnikov 2017/01/30 12:50:36 this was the only usage of the "noIcon" argument
995 this._categoryElements[resourceType.name()] = categoryElement; 1001 this._categoryElements[resourceType.name()] = categoryElement;
996 this._insertInPresentationOrder(this, categoryElement); 1002 this._insertInPresentationOrder(this, categoryElement);
997 } 1003 }
998 var resourceTreeElement = new Resources.FrameResourceTreeElement(this._stora gePanel, resource); 1004 var resourceTreeElement = new Resources.FrameResourceTreeElement(this._stora gePanel, resource);
999 this._insertInPresentationOrder(categoryElement, resourceTreeElement); 1005 this._insertInPresentationOrder(categoryElement, resourceTreeElement);
1000 this._treeElementForResource[resource.url] = resourceTreeElement; 1006 this._treeElementForResource[resource.url] = resourceTreeElement;
1001 } 1007 }
1002 1008
1003 /** 1009 /**
1004 * @param {string} url 1010 * @param {string} url
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 1058
1053 /** 1059 /**
1054 * @unrestricted 1060 * @unrestricted
1055 */ 1061 */
1056 Resources.FrameResourceTreeElement = class extends Resources.BaseStorageTreeElem ent { 1062 Resources.FrameResourceTreeElement = class extends Resources.BaseStorageTreeElem ent {
1057 /** 1063 /**
1058 * @param {!Resources.ResourcesPanel} storagePanel 1064 * @param {!Resources.ResourcesPanel} storagePanel
1059 * @param {!SDK.Resource} resource 1065 * @param {!SDK.Resource} resource
1060 */ 1066 */
1061 constructor(storagePanel, resource) { 1067 constructor(storagePanel, resource) {
1062 super(storagePanel, resource.displayName, [ 1068 super(storagePanel, resource.displayName, false);
1063 'navigator-tree-item', 'navigator-file-tree-item', 'navigator-' + resource .resourceType().name() + '-tree-item'
1064 ]);
1065 /** @type {!SDK.Resource} */ 1069 /** @type {!SDK.Resource} */
1066 this._resource = resource; 1070 this._resource = resource;
1067 this.tooltip = resource.url; 1071 this.tooltip = resource.url;
1068 this._resource[Resources.FrameResourceTreeElement._symbol] = this; 1072 this._resource[Resources.FrameResourceTreeElement._symbol] = this;
1073
1074 var icon = UI.Icon.create('largeicon-navigator-file', 'navigator-tree-item') ;
1075 icon.classList.add('navigator-file-tree-item');
1076 icon.classList.add('navigator-' + resource.resourceType().name() + '-tree-it em');
1077 this.setLeadingIcons([icon]);
1069 } 1078 }
1070 1079
1071 get itemURL() { 1080 get itemURL() {
1072 return this._resource.url; 1081 return this._resource.url;
1073 } 1082 }
1074 1083
1075 /** 1084 /**
1076 * @override 1085 * @override
1077 * @return {boolean} 1086 * @return {boolean}
1078 */ 1087 */
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1143
1135 /** 1144 /**
1136 * @unrestricted 1145 * @unrestricted
1137 */ 1146 */
1138 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { 1147 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement {
1139 /** 1148 /**
1140 * @param {!Resources.ResourcesPanel} storagePanel 1149 * @param {!Resources.ResourcesPanel} storagePanel
1141 * @param {!Resources.Database} database 1150 * @param {!Resources.Database} database
1142 */ 1151 */
1143 constructor(storagePanel, database) { 1152 constructor(storagePanel, database) {
1144 super(storagePanel, database.name, ['database-tree-item', 'resource-tree-ite m'], true); 1153 super(storagePanel, database.name, true);
1145 this._database = database; 1154 this._database = database;
1155
1156 var icon = UI.Icon.create('resourceicon-database', 'resource-tree-item');
1157 this.setLeadingIcons([icon]);
1146 } 1158 }
1147 1159
1148 get itemURL() { 1160 get itemURL() {
1149 return 'database://' + encodeURI(this._database.name); 1161 return 'database://' + encodeURI(this._database.name);
1150 } 1162 }
1151 1163
1152 /** 1164 /**
1153 * @override 1165 * @override
1154 * @return {boolean} 1166 * @return {boolean}
1155 */ 1167 */
(...skipping 24 matching lines...) Expand all
1180 } 1192 }
1181 this._database.getTableNames(tableNamesCallback.bind(this)); 1193 this._database.getTableNames(tableNamesCallback.bind(this));
1182 } 1194 }
1183 }; 1195 };
1184 1196
1185 /** 1197 /**
1186 * @unrestricted 1198 * @unrestricted
1187 */ 1199 */
1188 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem ent { 1200 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem ent {
1189 constructor(storagePanel, database, tableName) { 1201 constructor(storagePanel, database, tableName) {
1190 super(storagePanel, tableName, ['table-tree-item', 'resource-tree-item']); 1202 super(storagePanel, tableName, false);
1191 this._database = database; 1203 this._database = database;
1192 this._tableName = tableName; 1204 this._tableName = tableName;
1205 var icon = UI.Icon.create('resourceicon-table', 'resource-tree-item');
1206 this.setLeadingIcons([icon]);
1193 } 1207 }
1194 1208
1195 get itemURL() { 1209 get itemURL() {
1196 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this ._tableName); 1210 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this ._tableName);
1197 } 1211 }
1198 1212
1199 /** 1213 /**
1200 * @override 1214 * @override
1201 * @return {boolean} 1215 * @return {boolean}
1202 */ 1216 */
1203 onselect(selectedByUser) { 1217 onselect(selectedByUser) {
1204 super.onselect(selectedByUser); 1218 super.onselect(selectedByUser);
1205 this._storagePanel._showDatabase(this._database, this._tableName); 1219 this._storagePanel._showDatabase(this._database, this._tableName);
1206 return false; 1220 return false;
1207 } 1221 }
1208 }; 1222 };
1209 1223
1210 /** 1224 /**
1211 * @unrestricted 1225 * @unrestricted
1212 */ 1226 */
1213 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement { 1227 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement {
1214 /** 1228 /**
1215 * @param {!Resources.ResourcesPanel} storagePanel 1229 * @param {!Resources.ResourcesPanel} storagePanel
1216 */ 1230 */
1217 constructor(storagePanel) { 1231 constructor(storagePanel) {
1218 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage', ['data base-tree-item', 'resource-tree-item']); 1232 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage');
1233 var icon = UI.Icon.create('resourceicon-database', 'resource-tree-item');
1234 this.setLeadingIcons([icon]);
1219 } 1235 }
1220 1236
1221 _initialize() { 1237 _initialize() {
1222 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ 1238 /** @type {!Array.<!Resources.SWCacheTreeElement>} */
1223 this._swCacheTreeElements = []; 1239 this._swCacheTreeElements = [];
1224 var target = this._storagePanel._target; 1240 var target = this._storagePanel._target;
1225 var model = target && SDK.ServiceWorkerCacheModel.fromTarget(target); 1241 var model = target && SDK.ServiceWorkerCacheModel.fromTarget(target);
1226 if (model) { 1242 if (model) {
1227 for (var cache of model.caches()) 1243 for (var cache of model.caches())
1228 this._addCache(model, cache); 1244 this._addCache(model, cache);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 /** 1330 /**
1315 * @unrestricted 1331 * @unrestricted
1316 */ 1332 */
1317 Resources.SWCacheTreeElement = class extends Resources.BaseStorageTreeElement { 1333 Resources.SWCacheTreeElement = class extends Resources.BaseStorageTreeElement {
1318 /** 1334 /**
1319 * @param {!Resources.ResourcesPanel} storagePanel 1335 * @param {!Resources.ResourcesPanel} storagePanel
1320 * @param {!SDK.ServiceWorkerCacheModel} model 1336 * @param {!SDK.ServiceWorkerCacheModel} model
1321 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache 1337 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache
1322 */ 1338 */
1323 constructor(storagePanel, model, cache) { 1339 constructor(storagePanel, model, cache) {
1324 super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, ['table- tree-item', 'resource-tree-item']); 1340 super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, false);
1325 this._model = model; 1341 this._model = model;
1326 this._cache = cache; 1342 this._cache = cache;
1343 var icon = UI.Icon.create('resourceicon-table', 'resource-tree-item');
1344 this.setLeadingIcons([icon]);
1327 } 1345 }
1328 1346
1329 get itemURL() { 1347 get itemURL() {
1330 // I don't think this will work at all. 1348 // I don't think this will work at all.
1331 return 'cache://' + this._cache.cacheId; 1349 return 'cache://' + this._cache.cacheId;
1332 } 1350 }
1333 1351
1334 /** 1352 /**
1335 * @override 1353 * @override
1336 */ 1354 */
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 }; 1396 };
1379 1397
1380 /** 1398 /**
1381 * @unrestricted 1399 * @unrestricted
1382 */ 1400 */
1383 Resources.ServiceWorkersTreeElement = class extends Resources.BaseStorageTreeEle ment { 1401 Resources.ServiceWorkersTreeElement = class extends Resources.BaseStorageTreeEle ment {
1384 /** 1402 /**
1385 * @param {!Resources.ResourcesPanel} storagePanel 1403 * @param {!Resources.ResourcesPanel} storagePanel
1386 */ 1404 */
1387 constructor(storagePanel) { 1405 constructor(storagePanel) {
1388 super(storagePanel, Common.UIString('Service Workers'), ['service-worker-tre e-item', 'resource-tree-item'], false); 1406 super(storagePanel, Common.UIString('Service Workers'), false);
1407 var icon = UI.Icon.create('resourceicon-service-worker', 'resource-tree-item ');
1408 this.setLeadingIcons([icon]);
1389 } 1409 }
1390 1410
1391 /** 1411 /**
1392 * @return {string} 1412 * @return {string}
1393 */ 1413 */
1394 get itemURL() { 1414 get itemURL() {
1395 return 'service-workers://'; 1415 return 'service-workers://';
1396 } 1416 }
1397 1417
1398 /** 1418 /**
(...skipping 10 matching lines...) Expand all
1409 }; 1429 };
1410 1430
1411 /** 1431 /**
1412 * @unrestricted 1432 * @unrestricted
1413 */ 1433 */
1414 Resources.AppManifestTreeElement = class extends Resources.BaseStorageTreeElemen t { 1434 Resources.AppManifestTreeElement = class extends Resources.BaseStorageTreeElemen t {
1415 /** 1435 /**
1416 * @param {!Resources.ResourcesPanel} storagePanel 1436 * @param {!Resources.ResourcesPanel} storagePanel
1417 */ 1437 */
1418 constructor(storagePanel) { 1438 constructor(storagePanel) {
1419 super(storagePanel, Common.UIString('Manifest'), ['manifest-tree-item', 'res ource-tree-item'], false, false); 1439 super(storagePanel, Common.UIString('Manifest'), false);
1440 var icon = UI.Icon.create('resourceicon-manifest', 'resource-tree-item');
1441 this.setLeadingIcons([icon]);
1420 } 1442 }
1421 1443
1422 /** 1444 /**
1423 * @return {string} 1445 * @return {string}
1424 */ 1446 */
1425 get itemURL() { 1447 get itemURL() {
1426 return 'manifest://'; 1448 return 'manifest://';
1427 } 1449 }
1428 1450
1429 /** 1451 /**
(...skipping 10 matching lines...) Expand all
1440 }; 1462 };
1441 1463
1442 /** 1464 /**
1443 * @unrestricted 1465 * @unrestricted
1444 */ 1466 */
1445 Resources.ClearStorageTreeElement = class extends Resources.BaseStorageTreeEleme nt { 1467 Resources.ClearStorageTreeElement = class extends Resources.BaseStorageTreeEleme nt {
1446 /** 1468 /**
1447 * @param {!Resources.ResourcesPanel} storagePanel 1469 * @param {!Resources.ResourcesPanel} storagePanel
1448 */ 1470 */
1449 constructor(storagePanel) { 1471 constructor(storagePanel) {
1450 super( 1472 super(storagePanel, Common.UIString('Clear storage'), false);
1451 storagePanel, Common.UIString('Clear storage'), ['clear-storage-tree-ite m', 'resource-tree-item'], false, 1473 var icon = UI.Icon.create('resourceicon-clear-storage', 'resource-tree-item' );
1452 false); 1474 this.setLeadingIcons([icon]);
1453 } 1475 }
1454 1476
1455 /** 1477 /**
1456 * @return {string} 1478 * @return {string}
1457 */ 1479 */
1458 get itemURL() { 1480 get itemURL() {
1459 return 'clear-storage://'; 1481 return 'clear-storage://';
1460 } 1482 }
1461 1483
1462 /** 1484 /**
(...skipping 10 matching lines...) Expand all
1473 }; 1495 };
1474 1496
1475 /** 1497 /**
1476 * @unrestricted 1498 * @unrestricted
1477 */ 1499 */
1478 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent { 1500 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent {
1479 /** 1501 /**
1480 * @param {!Resources.ResourcesPanel} storagePanel 1502 * @param {!Resources.ResourcesPanel} storagePanel
1481 */ 1503 */
1482 constructor(storagePanel) { 1504 constructor(storagePanel) {
1483 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB', ['database-tr ee-item', 'resource-tree-item']); 1505 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB');
1506 var icon = UI.Icon.create('resourceicon-database', 'resource-tree-item');
1507 this.setLeadingIcons([icon]);
1484 } 1508 }
1485 1509
1486 _initialize() { 1510 _initialize() {
1487 SDK.targetManager.addModelListener( 1511 SDK.targetManager.addModelListener(
1488 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded, this._indexedDBAdded, this); 1512 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded, this._indexedDBAdded, this);
1489 SDK.targetManager.addModelListener( 1513 SDK.targetManager.addModelListener(
1490 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseRemove d, this._indexedDBRemoved, this); 1514 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseRemove d, this._indexedDBRemoved, this);
1491 SDK.targetManager.addModelListener( 1515 SDK.targetManager.addModelListener(
1492 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseLoaded , this._indexedDBLoaded, this); 1516 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseLoaded , this._indexedDBLoaded, this);
1493 /** @type {!Array.<!Resources.IDBDatabaseTreeElement>} */ 1517 /** @type {!Array.<!Resources.IDBDatabaseTreeElement>} */
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 /** 1619 /**
1596 * @unrestricted 1620 * @unrestricted
1597 */ 1621 */
1598 Resources.IDBDatabaseTreeElement = class extends Resources.BaseStorageTreeElemen t { 1622 Resources.IDBDatabaseTreeElement = class extends Resources.BaseStorageTreeElemen t {
1599 /** 1623 /**
1600 * @param {!Resources.ResourcesPanel} storagePanel 1624 * @param {!Resources.ResourcesPanel} storagePanel
1601 * @param {!Resources.IndexedDBModel} model 1625 * @param {!Resources.IndexedDBModel} model
1602 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 1626 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
1603 */ 1627 */
1604 constructor(storagePanel, model, databaseId) { 1628 constructor(storagePanel, model, databaseId) {
1605 super( 1629 super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, fal se);
1606 storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin,
1607 ['database-tree-item', 'resource-tree-item']);
1608 this._model = model; 1630 this._model = model;
1609 this._databaseId = databaseId; 1631 this._databaseId = databaseId;
1610 this._idbObjectStoreTreeElements = {}; 1632 this._idbObjectStoreTreeElements = {};
1633 var icon = UI.Icon.create('resourceicon-database', 'resource-tree-item');
1634 this.setLeadingIcons([icon]);
1611 } 1635 }
1612 1636
1613 get itemURL() { 1637 get itemURL() {
1614 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name; 1638 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name;
1615 } 1639 }
1616 1640
1617 /** 1641 /**
1618 * @override 1642 * @override
1619 */ 1643 */
1620 onattach() { 1644 onattach() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 * @unrestricted 1721 * @unrestricted
1698 */ 1722 */
1699 Resources.IDBObjectStoreTreeElement = class extends Resources.BaseStorageTreeEle ment { 1723 Resources.IDBObjectStoreTreeElement = class extends Resources.BaseStorageTreeEle ment {
1700 /** 1724 /**
1701 * @param {!Resources.ResourcesPanel} storagePanel 1725 * @param {!Resources.ResourcesPanel} storagePanel
1702 * @param {!Resources.IndexedDBModel} model 1726 * @param {!Resources.IndexedDBModel} model
1703 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 1727 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
1704 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore 1728 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore
1705 */ 1729 */
1706 constructor(storagePanel, model, databaseId, objectStore) { 1730 constructor(storagePanel, model, databaseId, objectStore) {
1707 super(storagePanel, objectStore.name, ['table-tree-item', 'resource-tree-ite m']); 1731 super(storagePanel, objectStore.name, false);
1708 this._model = model; 1732 this._model = model;
1709 this._databaseId = databaseId; 1733 this._databaseId = databaseId;
1710 this._idbIndexTreeElements = {}; 1734 this._idbIndexTreeElements = {};
1735 var icon = UI.Icon.create('resourceicon-table', 'resource-tree-item');
1736 this.setLeadingIcons([icon]);
1711 } 1737 }
1712 1738
1713 get itemURL() { 1739 get itemURL() {
1714 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name + '/' + 1740 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name + '/' +
1715 this._objectStore.name; 1741 this._objectStore.name;
1716 } 1742 }
1717 1743
1718 /** 1744 /**
1719 * @override 1745 * @override
1720 */ 1746 */
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 */ 1847 */
1822 Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement { 1848 Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement {
1823 /** 1849 /**
1824 * @param {!Resources.ResourcesPanel} storagePanel 1850 * @param {!Resources.ResourcesPanel} storagePanel
1825 * @param {!Resources.IndexedDBModel} model 1851 * @param {!Resources.IndexedDBModel} model
1826 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 1852 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
1827 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore 1853 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore
1828 * @param {!Resources.IndexedDBModel.Index} index 1854 * @param {!Resources.IndexedDBModel.Index} index
1829 */ 1855 */
1830 constructor(storagePanel, model, databaseId, objectStore, index) { 1856 constructor(storagePanel, model, databaseId, objectStore, index) {
1831 super(storagePanel, index.name, ['index-tree-item', 'resource-tree-item']); 1857 super(storagePanel, index.name, false);
1832 this._model = model; 1858 this._model = model;
1833 this._databaseId = databaseId; 1859 this._databaseId = databaseId;
1834 this._objectStore = objectStore; 1860 this._objectStore = objectStore;
1835 this._index = index; 1861 this._index = index;
1836 } 1862 }
1837 1863
1838 get itemURL() { 1864 get itemURL() {
1839 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name + '/' + 1865 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name + '/' +
1840 this._objectStore.name + '/' + this._index.name; 1866 this._objectStore.name + '/' + this._index.name;
1841 } 1867 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 if (this._view) 1906 if (this._view)
1881 this._view.clear(); 1907 this._view.clear();
1882 } 1908 }
1883 }; 1909 };
1884 1910
1885 /** 1911 /**
1886 * @unrestricted 1912 * @unrestricted
1887 */ 1913 */
1888 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement { 1914 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement {
1889 constructor(storagePanel, domStorage) { 1915 constructor(storagePanel, domStorage) {
1890 super( 1916 super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'), false);
1891 storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Co mmon.UIString('Local Files'),
1892 ['table-tree-item', 'resource-tree-item']);
1893 this._domStorage = domStorage; 1917 this._domStorage = domStorage;
1918 var icon = UI.Icon.create('resourceicon-table', 'resource-tree-item');
1919 this.setLeadingIcons([icon]);
1894 } 1920 }
1895 1921
1896 get itemURL() { 1922 get itemURL() {
1897 return 'storage://' + this._domStorage.securityOrigin + '/' + 1923 return 'storage://' + this._domStorage.securityOrigin + '/' +
1898 (this._domStorage.isLocalStorage ? 'local' : 'session'); 1924 (this._domStorage.isLocalStorage ? 'local' : 'session');
1899 } 1925 }
1900 1926
1901 /** 1927 /**
1902 * @override 1928 * @override
1903 * @return {boolean} 1929 * @return {boolean}
(...skipping 17 matching lines...) Expand all
1921 contextMenu.appendItem(Common.UIString('Clear'), () => this._domStorage.clea r()); 1947 contextMenu.appendItem(Common.UIString('Clear'), () => this._domStorage.clea r());
1922 contextMenu.show(); 1948 contextMenu.show();
1923 } 1949 }
1924 }; 1950 };
1925 1951
1926 /** 1952 /**
1927 * @unrestricted 1953 * @unrestricted
1928 */ 1954 */
1929 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement { 1955 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement {
1930 constructor(storagePanel, frame, cookieDomain) { 1956 constructor(storagePanel, frame, cookieDomain) {
1931 super( 1957 super(storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Fil es'), false);
1932 storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files '),
1933 ['cookie-tree-item', 'resource-tree-item']);
1934 this._frame = frame; 1958 this._frame = frame;
1935 this._cookieDomain = cookieDomain; 1959 this._cookieDomain = cookieDomain;
1960 var icon = UI.Icon.create('resourceicon-cookie', 'resource-tree-item');
1961 this.setLeadingIcons([icon]);
1936 } 1962 }
1937 1963
1938 get itemURL() { 1964 get itemURL() {
1939 return 'cookies://' + this._cookieDomain; 1965 return 'cookies://' + this._cookieDomain;
1940 } 1966 }
1941 1967
1942 /** 1968 /**
1943 * @override 1969 * @override
1944 */ 1970 */
1945 onattach() { 1971 onattach() {
(...skipping 27 matching lines...) Expand all
1973 return false; 1999 return false;
1974 } 2000 }
1975 }; 2001 };
1976 2002
1977 /** 2003 /**
1978 * @unrestricted 2004 * @unrestricted
1979 */ 2005 */
1980 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor ageTreeElement { 2006 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor ageTreeElement {
1981 constructor(storagePanel, manifestURL) { 2007 constructor(storagePanel, manifestURL) {
1982 var title = new Common.ParsedURL(manifestURL).displayName; 2008 var title = new Common.ParsedURL(manifestURL).displayName;
1983 super(storagePanel, title, ['application-cache-storage-tree-item']); 2009 super(storagePanel, title, false);
1984 this.tooltip = manifestURL; 2010 this.tooltip = manifestURL;
1985 this._manifestURL = manifestURL; 2011 this._manifestURL = manifestURL;
1986 } 2012 }
1987 2013
1988 get itemURL() { 2014 get itemURL() {
1989 return 'appcache://' + this._manifestURL; 2015 return 'appcache://' + this._manifestURL;
1990 } 2016 }
1991 2017
1992 get manifestURL() { 2018 get manifestURL() {
1993 return this._manifestURL; 2019 return this._manifestURL;
(...skipping 13 matching lines...) Expand all
2007 /** 2033 /**
2008 * @unrestricted 2034 * @unrestricted
2009 */ 2035 */
2010 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement { 2036 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement {
2011 /** 2037 /**
2012 * @param {!Resources.ResourcesPanel} storagePanel 2038 * @param {!Resources.ResourcesPanel} storagePanel
2013 * @param {!Protocol.Page.FrameId} frameId 2039 * @param {!Protocol.Page.FrameId} frameId
2014 * @param {string} manifestURL 2040 * @param {string} manifestURL
2015 */ 2041 */
2016 constructor(storagePanel, frameId, manifestURL) { 2042 constructor(storagePanel, frameId, manifestURL) {
2017 super(storagePanel, '', ['navigator-tree-item', 'navigator-folder-tree-item' ]); 2043 super(storagePanel, '', false);
2018 this._frameId = frameId; 2044 this._frameId = frameId;
2019 this._manifestURL = manifestURL; 2045 this._manifestURL = manifestURL;
2020 this._refreshTitles(); 2046 this._refreshTitles();
2047
2048 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item ');
2049 icon.classList.add('navigator-folder-tree-item');
2050 this.setLeadingIcons([icon]);
2021 } 2051 }
2022 2052
2023 get itemURL() { 2053 get itemURL() {
2024 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText( )); 2054 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText( ));
2025 } 2055 }
2026 2056
2027 get frameId() { 2057 get frameId() {
2028 return this._frameId; 2058 return this._frameId;
2029 } 2059 }
2030 2060
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 2092
2063 this.element.classList.add('storage-view'); 2093 this.element.classList.add('storage-view');
2064 this._emptyWidget = new UI.EmptyWidget(''); 2094 this._emptyWidget = new UI.EmptyWidget('');
2065 this._emptyWidget.show(this.element); 2095 this._emptyWidget.show(this.element);
2066 } 2096 }
2067 2097
2068 setText(text) { 2098 setText(text) {
2069 this._emptyWidget.text = text; 2099 this._emptyWidget.text = text;
2070 } 2100 }
2071 }; 2101 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698