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

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

Issue 2660893002: DevTools: migrate ResourcesPanel icons over to UI.Icon (Closed)
Patch Set: resourceicon-* into mediumicon-* Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/resources/resourcesSidebar.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
index 647480927a76878dac1e6c4f333c2c33cb1eec85..5b28d04d94acebaa19fd40a82851d6572832f436 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
@@ -53,27 +53,39 @@ Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
this._applicationTreeElement.appendChild(clearStorageTreeElement);
var storageTreeElement = this._addSidebarSection(Common.UIString('Storage'));
- this.localStorageListTreeElement = new Resources.StorageCategoryTreeElement(
- this, Common.UIString('Local Storage'), 'LocalStorage', ['table-tree-item', 'resource-tree-item']);
+ this.localStorageListTreeElement =
+ new Resources.StorageCategoryTreeElement(this, Common.UIString('Local Storage'), 'LocalStorage');
+ var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]);
+
storageTreeElement.appendChild(this.localStorageListTreeElement);
- this.sessionStorageListTreeElement = new Resources.StorageCategoryTreeElement(
- this, Common.UIString('Session Storage'), 'SessionStorage', ['table-tree-item', 'resource-tree-item']);
+ this.sessionStorageListTreeElement =
+ new Resources.StorageCategoryTreeElement(this, Common.UIString('Session Storage'), 'SessionStorage');
+ var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]);
+
storageTreeElement.appendChild(this.sessionStorageListTreeElement);
this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(this);
storageTreeElement.appendChild(this.indexedDBListTreeElement);
- this.databasesListTreeElement = new Resources.StorageCategoryTreeElement(
- this, Common.UIString('Web SQL'), 'Databases', ['database-tree-item', 'resource-tree-item']);
+ this.databasesListTreeElement =
+ new Resources.StorageCategoryTreeElement(this, Common.UIString('Web SQL'), 'Databases');
+ var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ this.databasesListTreeElement.setLeadingIcons([databaseIcon]);
+
storageTreeElement.appendChild(this.databasesListTreeElement);
- this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(
- this, Common.UIString('Cookies'), 'Cookies', ['cookie-tree-item', 'resource-tree-item']);
+ this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(this, Common.UIString('Cookies'), 'Cookies');
+ var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item');
+ this.cookieListTreeElement.setLeadingIcons([cookieIcon]);
storageTreeElement.appendChild(this.cookieListTreeElement);
var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache'));
this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeElement(this);
cacheTreeElement.appendChild(this.cacheStorageListTreeElement);
- this.applicationCacheListTreeElement = new Resources.StorageCategoryTreeElement(
- this, Common.UIString('Application Cache'), 'ApplicationCache',
- ['appcache-tree-item', 'table-tree-item', 'resource-tree-item']);
+ this.applicationCacheListTreeElement =
+ new Resources.StorageCategoryTreeElement(this, Common.UIString('Application Cache'), 'ApplicationCache');
+ var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon]);
+
cacheTreeElement.appendChild(this.applicationCacheListTreeElement);
this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Frames'));
@@ -837,19 +849,11 @@ Resources.BaseStorageTreeElement = class extends UI.TreeElement {
/**
* @param {!Resources.ResourcesPanel} storagePanel
* @param {string} title
- * @param {?Array.<string>=} iconClasses
- * @param {boolean=} expandable
- * @param {boolean=} noIcon
+ * @param {boolean} expandable
*/
- constructor(storagePanel, title, iconClasses, expandable, noIcon) {
+ constructor(storagePanel, title, expandable) {
super(title, expandable);
this._storagePanel = storagePanel;
- for (var i = 0; iconClasses && i < iconClasses.length; ++i)
- this.listItemElement.classList.add(iconClasses[i]);
-
- this._iconClasses = iconClasses;
- if (!noIcon)
- this.createIcon();
}
/**
@@ -874,11 +878,9 @@ Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl
* @param {!Resources.ResourcesPanel} storagePanel
* @param {string} categoryName
* @param {string} settingsKey
- * @param {?Array.<string>=} iconClasses
- * @param {boolean=} noIcon
*/
- constructor(storagePanel, categoryName, settingsKey, iconClasses, noIcon) {
- super(storagePanel, categoryName, iconClasses, false, noIcon);
+ constructor(storagePanel, categoryName, settingsKey) {
+ super(storagePanel, categoryName, false);
this._expandedSetting =
Common.settings.createSetting('resources' + settingsKey + 'Expanded', settingsKey === 'Frames');
this._categoryName = categoryName;
@@ -938,9 +940,13 @@ Resources.FrameTreeElement = class extends Resources.BaseStorageTreeElement {
* @param {!SDK.ResourceTreeFrame} frame
*/
constructor(storagePanel, frame) {
- super(storagePanel, '', ['navigator-tree-item', 'navigator-frame-tree-item']);
+ super(storagePanel, '', false);
this._frame = frame;
this.frameNavigated(frame);
+
+ var icon = UI.Icon.create('largeicon-navigator-frame', 'navigator-tree-item');
+ icon.classList.add('navigator-frame-tree-item');
+ this.setLeadingIcons([icon]);
}
frameNavigated(frame) {
@@ -991,7 +997,7 @@ Resources.FrameTreeElement = class extends Resources.BaseStorageTreeElement {
var categoryElement = resourceType === Common.resourceTypes.Document ? this : this._categoryElements[categoryName];
if (!categoryElement) {
categoryElement = new Resources.StorageCategoryTreeElement(
- this._storagePanel, resource.resourceType().category().title, categoryName, null, true);
+ this._storagePanel, resource.resourceType().category().title, categoryName);
this._categoryElements[resourceType.name()] = categoryElement;
this._insertInPresentationOrder(this, categoryElement);
}
@@ -1059,13 +1065,16 @@ Resources.FrameResourceTreeElement = class extends Resources.BaseStorageTreeElem
* @param {!SDK.Resource} resource
*/
constructor(storagePanel, resource) {
- super(storagePanel, resource.displayName, [
- 'navigator-tree-item', 'navigator-file-tree-item', 'navigator-' + resource.resourceType().name() + '-tree-item'
- ]);
+ super(storagePanel, resource.displayName, false);
/** @type {!SDK.Resource} */
this._resource = resource;
this.tooltip = resource.url;
this._resource[Resources.FrameResourceTreeElement._symbol] = this;
+
+ var icon = UI.Icon.create('largeicon-navigator-file', 'navigator-tree-item');
+ icon.classList.add('navigator-file-tree-item');
+ icon.classList.add('navigator-' + resource.resourceType().name() + '-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1141,8 +1150,11 @@ Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement {
* @param {!Resources.Database} database
*/
constructor(storagePanel, database) {
- super(storagePanel, database.name, ['database-tree-item', 'resource-tree-item'], true);
+ super(storagePanel, database.name, true);
this._database = database;
+
+ var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1187,9 +1199,11 @@ Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement {
*/
Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElement {
constructor(storagePanel, database, tableName) {
- super(storagePanel, tableName, ['table-tree-item', 'resource-tree-item']);
+ super(storagePanel, tableName, false);
this._database = database;
this._tableName = tableName;
+ var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1215,7 +1229,9 @@ Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor
* @param {!Resources.ResourcesPanel} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage', ['database-tree-item', 'resource-tree-item']);
+ super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage');
+ var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
_initialize() {
@@ -1321,9 +1337,11 @@ Resources.SWCacheTreeElement = class extends Resources.BaseStorageTreeElement {
* @param {!SDK.ServiceWorkerCacheModel.Cache} cache
*/
constructor(storagePanel, model, cache) {
- super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, ['table-tree-item', 'resource-tree-item']);
+ super(storagePanel, cache.cacheName + ' - ' + cache.securityOrigin, false);
this._model = model;
this._cache = cache;
+ var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1385,7 +1403,9 @@ Resources.ServiceWorkersTreeElement = class extends Resources.BaseStorageTreeEle
* @param {!Resources.ResourcesPanel} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Service Workers'), ['service-worker-tree-item', 'resource-tree-item'], false);
+ super(storagePanel, Common.UIString('Service Workers'), false);
+ var icon = UI.Icon.create('mediumicon-service-worker', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
/**
@@ -1416,7 +1436,9 @@ Resources.AppManifestTreeElement = class extends Resources.BaseStorageTreeElemen
* @param {!Resources.ResourcesPanel} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('Manifest'), ['manifest-tree-item', 'resource-tree-item'], false, false);
+ super(storagePanel, Common.UIString('Manifest'), false);
+ var icon = UI.Icon.create('mediumicon-manifest', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
/**
@@ -1447,9 +1469,9 @@ Resources.ClearStorageTreeElement = class extends Resources.BaseStorageTreeEleme
* @param {!Resources.ResourcesPanel} storagePanel
*/
constructor(storagePanel) {
- super(
- storagePanel, Common.UIString('Clear storage'), ['clear-storage-tree-item', 'resource-tree-item'], false,
- false);
+ super(storagePanel, Common.UIString('Clear storage'), false);
+ var icon = UI.Icon.create('mediumicon-clear-storage', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
/**
@@ -1480,7 +1502,9 @@ Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem
* @param {!Resources.ResourcesPanel} storagePanel
*/
constructor(storagePanel) {
- super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB', ['database-tree-item', 'resource-tree-item']);
+ super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB');
+ var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
_initialize() {
@@ -1602,12 +1626,12 @@ Resources.IDBDatabaseTreeElement = class extends Resources.BaseStorageTreeElemen
* @param {!Resources.IndexedDBModel.DatabaseId} databaseId
*/
constructor(storagePanel, model, databaseId) {
- super(
- storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin,
- ['database-tree-item', 'resource-tree-item']);
+ super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, false);
this._model = model;
this._databaseId = databaseId;
this._idbObjectStoreTreeElements = {};
+ var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1704,10 +1728,12 @@ Resources.IDBObjectStoreTreeElement = class extends Resources.BaseStorageTreeEle
* @param {!Resources.IndexedDBModel.ObjectStore} objectStore
*/
constructor(storagePanel, model, databaseId, objectStore) {
- super(storagePanel, objectStore.name, ['table-tree-item', 'resource-tree-item']);
+ super(storagePanel, objectStore.name, false);
this._model = model;
this._databaseId = databaseId;
this._idbIndexTreeElements = {};
+ var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1828,7 +1854,7 @@ Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement {
* @param {!Resources.IndexedDBModel.Index} index
*/
constructor(storagePanel, model, databaseId, objectStore, index) {
- super(storagePanel, index.name, ['index-tree-item', 'resource-tree-item']);
+ super(storagePanel, index.name, false);
this._model = model;
this._databaseId = databaseId;
this._objectStore = objectStore;
@@ -1887,10 +1913,10 @@ Resources.IDBIndexTreeElement = class extends Resources.BaseStorageTreeElement {
*/
Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement {
constructor(storagePanel, domStorage) {
- super(
- storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'),
- ['table-tree-item', 'resource-tree-item']);
+ super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'), false);
this._domStorage = domStorage;
+ var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1928,11 +1954,11 @@ Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement
*/
Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement {
constructor(storagePanel, frame, cookieDomain) {
- super(
- storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files'),
- ['cookie-tree-item', 'resource-tree-item']);
+ super(storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files'), false);
this._frame = frame;
this._cookieDomain = cookieDomain;
+ var icon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
@@ -1980,7 +2006,7 @@ Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement {
Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStorageTreeElement {
constructor(storagePanel, manifestURL) {
var title = new Common.ParsedURL(manifestURL).displayName;
- super(storagePanel, title, ['application-cache-storage-tree-item']);
+ super(storagePanel, title, false);
this.tooltip = manifestURL;
this._manifestURL = manifestURL;
}
@@ -2014,10 +2040,14 @@ Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage
* @param {string} manifestURL
*/
constructor(storagePanel, frameId, manifestURL) {
- super(storagePanel, '', ['navigator-tree-item', 'navigator-folder-tree-item']);
+ super(storagePanel, '', false);
this._frameId = frameId;
this._manifestURL = manifestURL;
this._refreshTitles();
+
+ var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item');
+ icon.classList.add('navigator-folder-tree-item');
+ this.setLeadingIcons([icon]);
}
get itemURL() {
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/resources/resourcesSidebar.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698