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

Unified 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 side-by-side diff with in-line comments
Download patch
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 de4043087fd4342c1da10823079617c4d12179cb..9a68b04f0301696ee259ff3e24bf60d2135c6dba 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
@@ -79,8 +79,8 @@ Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
this.resourcesListTreeElement = this._addSidebarSection(Common.UIString('Frames'));
var mainContainer = new UI.VBox();
- this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto');
this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer.element);
+ this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto');
this.splitWidget().setMainWidget(mainContainer);
/** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTableView>>} */
@@ -580,6 +580,16 @@ Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
}
/**
+ * @param {!Resources.DOMStorage} domStorage
+ */
+ _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...
+ if (!domStorage)
pfeldman 2017/01/19 23:38:46 You just declared it as not nullable.
eostroukhov 2017/01/20 19:24:00 Acknowledged.
+ return;
+
+ domStorage.clear();
+ }
+
+ /**
* @param {!Resources.CookieTreeElement} treeElement
* @param {string} cookieDomain
*/
@@ -1902,6 +1912,25 @@ Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement
this._storagePanel._showDOMStorage(this._domStorage);
return false;
}
+
+ /**
+ * @override
+ */
+ onattach() {
+ super.onattach();
+ this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ }
+
+ _handleContextMenuEvent(event) {
+ var contextMenu = new UI.ContextMenu(event);
+ if (this._domStorage.isLocalStorage)
+ contextMenu.appendItem(Common.UIString('Clear'), this._clearDOMStorage.bind(this));
pfeldman 2017/01/19 23:38:46 () => this._domStorage.clear()
eostroukhov 2017/01/20 19:24:00 Done.
+ contextMenu.show();
+ }
+
+ _clearDOMStorage() {
pfeldman 2017/01/19 23:38:46 You don't need it.
eostroukhov 2017/01/20 19:24:00 Done.
+ this._storagePanel._clearDOMStorage(this._domStorage);
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698