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

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

Issue 2632553002: [DevTools] Clear local storage (Closed)
Patch Set: Addressed comments, moved the toolbar. 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 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme nt(this); 72 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme nt(this);
73 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); 73 cacheTreeElement.appendChild(this.cacheStorageListTreeElement);
74 this.applicationCacheListTreeElement = new Resources.StorageCategoryTreeElem ent( 74 this.applicationCacheListTreeElement = new Resources.StorageCategoryTreeElem ent(
75 this, Common.UIString('Application Cache'), 'ApplicationCache', 75 this, Common.UIString('Application Cache'), 'ApplicationCache',
76 ['appcache-tree-item', 'table-tree-item', 'resource-tree-item']); 76 ['appcache-tree-item', 'table-tree-item', 'resource-tree-item']);
77 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); 77 cacheTreeElement.appendChild(this.applicationCacheListTreeElement);
78 78
79 this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Fra mes')); 79 this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Fra mes'));
80 80
81 var mainContainer = new UI.VBox(); 81 var mainContainer = new UI.VBox();
82 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element);
82 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto '); 83 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto ');
83 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer .element);
84 this.splitWidget().setMainWidget(mainContainer); 84 this.splitWidget().setMainWidget(mainContainer);
85 85
86 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */ 86 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa bleView>>} */
87 this._databaseTableViews = new Map(); 87 this._databaseTableViews = new Map();
88 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ 88 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */
89 this._databaseQueryViews = new Map(); 89 this._databaseQueryViews = new Map();
90 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ 90 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */
91 this._databaseTreeElements = new Map(); 91 this._databaseTreeElements = new Map();
92 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageItemsView>} */ 92 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageItemsView>} */
93 this._domStorageViews = new Map(); 93 this._domStorageViews = new Map();
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 view = this._domStorageViews.get(domStorage); 573 view = this._domStorageViews.get(domStorage);
574 if (!view) { 574 if (!view) {
575 view = new Resources.DOMStorageItemsView(domStorage); 575 view = new Resources.DOMStorageItemsView(domStorage);
576 this._domStorageViews.set(domStorage, view); 576 this._domStorageViews.set(domStorage, view);
577 } 577 }
578 578
579 this._innerShowView(view); 579 this._innerShowView(view);
580 } 580 }
581 581
582 /** 582 /**
583 * @param {!Resources.DOMStorage} domStorage
584 */
585 _clearDOMStorage(domStorage) {
pfeldman 2017/01/19 23:38:46 Why do you need a method that calls a method on th
eostroukhov 2017/01/20 19:24:00 Fixed. Vestige of an older implementation...
586 if (!domStorage)
pfeldman 2017/01/19 23:38:46 You just declared it as not nullable.
eostroukhov 2017/01/20 19:24:00 Acknowledged.
587 return;
588
589 domStorage.clear();
590 }
591
592 /**
583 * @param {!Resources.CookieTreeElement} treeElement 593 * @param {!Resources.CookieTreeElement} treeElement
584 * @param {string} cookieDomain 594 * @param {string} cookieDomain
585 */ 595 */
586 showCookies(treeElement, cookieDomain) { 596 showCookies(treeElement, cookieDomain) {
587 var view = this._cookieViews[cookieDomain]; 597 var view = this._cookieViews[cookieDomain];
588 if (!view) { 598 if (!view) {
589 view = new Resources.CookieItemsView(treeElement, cookieDomain); 599 view = new Resources.CookieItemsView(treeElement, cookieDomain);
590 this._cookieViews[cookieDomain] = view; 600 this._cookieViews[cookieDomain] = view;
591 } 601 }
592 602
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1905
1896 /** 1906 /**
1897 * @override 1907 * @override
1898 * @return {boolean} 1908 * @return {boolean}
1899 */ 1909 */
1900 onselect(selectedByUser) { 1910 onselect(selectedByUser) {
1901 super.onselect(selectedByUser); 1911 super.onselect(selectedByUser);
1902 this._storagePanel._showDOMStorage(this._domStorage); 1912 this._storagePanel._showDOMStorage(this._domStorage);
1903 return false; 1913 return false;
1904 } 1914 }
1915
1916 /**
1917 * @override
1918 */
1919 onattach() {
1920 super.onattach();
1921 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
1922 }
1923
1924 _handleContextMenuEvent(event) {
1925 var contextMenu = new UI.ContextMenu(event);
1926 if (this._domStorage.isLocalStorage)
1927 contextMenu.appendItem(Common.UIString('Clear'), this._clearDOMStorage.bin d(this));
pfeldman 2017/01/19 23:38:46 () => this._domStorage.clear()
eostroukhov 2017/01/20 19:24:00 Done.
1928 contextMenu.show();
1929 }
1930
1931 _clearDOMStorage() {
pfeldman 2017/01/19 23:38:46 You don't need it.
eostroukhov 2017/01/20 19:24:00 Done.
1932 this._storagePanel._clearDOMStorage(this._domStorage);
1933 }
1905 }; 1934 };
1906 1935
1907 /** 1936 /**
1908 * @unrestricted 1937 * @unrestricted
1909 */ 1938 */
1910 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement { 1939 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement {
1911 constructor(storagePanel, cookieDomain) { 1940 constructor(storagePanel, cookieDomain) {
1912 super( 1941 super(
1913 storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files '), 1942 storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files '),
1914 ['cookie-tree-item', 'resource-tree-item']); 1943 ['cookie-tree-item', 'resource-tree-item']);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 2071
2043 this.element.classList.add('storage-view'); 2072 this.element.classList.add('storage-view');
2044 this._emptyWidget = new UI.EmptyWidget(''); 2073 this._emptyWidget = new UI.EmptyWidget('');
2045 this._emptyWidget.show(this.element); 2074 this._emptyWidget.show(this.element);
2046 } 2075 }
2047 2076
2048 setText(text) { 2077 setText(text) {
2049 this._emptyWidget.text = text; 2078 this._emptyWidget.text = text;
2050 } 2079 }
2051 }; 2080 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698