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

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

Issue 2632553002: [DevTools] Clear local storage (Closed)
Patch Set: 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 562 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) {
586 if (!domStorage)
587 return;
588
589 var view = this._domStorageViews.get(domStorage);
590 if (view)
591 view.clear();
592 else
593 domStorage.clear();
594 }
595
596 /**
583 * @param {!Resources.CookieTreeElement} treeElement 597 * @param {!Resources.CookieTreeElement} treeElement
584 * @param {string} cookieDomain 598 * @param {string} cookieDomain
585 */ 599 */
586 showCookies(treeElement, cookieDomain) { 600 showCookies(treeElement, cookieDomain) {
587 var view = this._cookieViews[cookieDomain]; 601 var view = this._cookieViews[cookieDomain];
588 if (!view) { 602 if (!view) {
589 view = new Resources.CookieItemsView(treeElement, cookieDomain); 603 view = new Resources.CookieItemsView(treeElement, cookieDomain);
590 this._cookieViews[cookieDomain] = view; 604 this._cookieViews[cookieDomain] = view;
591 } 605 }
592 606
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1909
1896 /** 1910 /**
1897 * @override 1911 * @override
1898 * @return {boolean} 1912 * @return {boolean}
1899 */ 1913 */
1900 onselect(selectedByUser) { 1914 onselect(selectedByUser) {
1901 super.onselect(selectedByUser); 1915 super.onselect(selectedByUser);
1902 this._storagePanel._showDOMStorage(this._domStorage); 1916 this._storagePanel._showDOMStorage(this._domStorage);
1903 return false; 1917 return false;
1904 } 1918 }
1919
1920 /**
1921 * @override
1922 */
1923 onattach() {
1924 super.onattach();
1925 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
pfeldman 2017/01/13 18:51:25 Drop context menu.
eostroukhov 2017/01/19 00:42:10 I do not see any harm in having this menu item - s
1926 }
1927
1928 _handleContextMenuEvent(event) {
1929 var contextMenu = new UI.ContextMenu(event);
1930 if (this._domStorage.isLocalStorage)
1931 contextMenu.appendItem(Common.UIString('Clear'), this._clearDOMStorage.bin d(this));
1932 contextMenu.show();
1933 }
1934
1935 _clearDOMStorage() {
1936 this._storagePanel._clearDOMStorage(this._domStorage);
1937 }
1905 }; 1938 };
1906 1939
1907 /** 1940 /**
1908 * @unrestricted 1941 * @unrestricted
1909 */ 1942 */
1910 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement { 1943 Resources.CookieTreeElement = class extends Resources.BaseStorageTreeElement {
1911 constructor(storagePanel, cookieDomain) { 1944 constructor(storagePanel, cookieDomain) {
1912 super( 1945 super(
1913 storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files '), 1946 storagePanel, cookieDomain ? cookieDomain : Common.UIString('Local Files '),
1914 ['cookie-tree-item', 'resource-tree-item']); 1947 ['cookie-tree-item', 'resource-tree-item']);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 2075
2043 this.element.classList.add('storage-view'); 2076 this.element.classList.add('storage-view');
2044 this._emptyWidget = new UI.EmptyWidget(''); 2077 this._emptyWidget = new UI.EmptyWidget('');
2045 this._emptyWidget.show(this.element); 2078 this._emptyWidget.show(this.element);
2046 } 2079 }
2047 2080
2048 setText(text) { 2081 setText(text) {
2049 this._emptyWidget.text = text; 2082 this._emptyWidget.text = text;
2050 } 2083 }
2051 }; 2084 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698