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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_data.js

Issue 2686063004: MD Settings: make blowing away per-origin data (i.e. cookies) easier (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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_data.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'site-data' handles showing the local storage summary list for all sites. 7 * 'site-data' handles showing the local storage summary list for all sites.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
11 is: 'site-data', 11 is: 'site-data',
12 12
13 behaviors: [CookieTreeBehavior], 13 behaviors: [CookieTreeBehavior],
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * The current filter applied to the cookie data list. 17 * The current filter applied to the cookie data list.
18 * @private 18 * @private
19 */ 19 */
20 filterString_: { 20 filterString_: {
21 type: String, 21 type: String,
22 value: '', 22 value: '',
23 }, 23 },
24 24
25 /** @private */ 25 /** @private */
26 confirmationDeleteMsg_: String, 26 confirmationDeleteMsg_: String,
27
28 /** @private */
29 idToDelete_: String,
Dan Beam 2017/02/11 01:09:27 unused (afaict)
30 }, 27 },
31 28
32 /** @override */ 29 /** @override */
33 ready: function() { 30 ready: function() {
34 this.loadCookies(); 31 this.loadCookies();
35 }, 32 },
36 33
37 /** 34 /**
38 * A filter function for the list. 35 * A filter function for the list.
39 * @param {!CookieDataSummaryItem} item The item to possibly filter out. 36 * @param {!CookieDataSummaryItem} item The item to possibly filter out.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 /** @private */ 68 /** @private */
72 onCloseDialog_: function() { 69 onCloseDialog_: function() {
73 this.$.confirmDeleteDialog.close(); 70 this.$.confirmDeleteDialog.close();
74 }, 71 },
75 72
76 /** 73 /**
77 * Shows a dialog to confirm the deletion of multiple sites. 74 * Shows a dialog to confirm the deletion of multiple sites.
78 * @param {!Event} e 75 * @param {!Event} e
79 * @private 76 * @private
80 */ 77 */
81 onConfirmDeleteMultipleSites_: function(e) { 78 onRemoveAllSitesTap_: function(e) {
82 e.preventDefault(); 79 e.preventDefault();
83 this.idToDelete_ = ''; // Delete all.
84 this.confirmationDeleteMsg_ = loadTimeData.getString( 80 this.confirmationDeleteMsg_ = loadTimeData.getString(
85 'siteSettingsCookieRemoveMultipleConfirmation'); 81 'siteSettingsCookieRemoveMultipleConfirmation');
86 this.$.confirmDeleteDialog.showModal(); 82 this.$.confirmDeleteDialog.showModal();
87 }, 83 },
88 84
89 /** 85 /**
90 * Called when deletion for a single/multiple sites has been confirmed. 86 * Called when deletion for a single/multiple sites has been confirmed.
91 * @private 87 * @private
92 */ 88 */
93 onConfirmDelete_: function() { 89 onConfirmDelete_: function() {
94 if (this.idToDelete_ != '')
95 this.onDeleteSite_();
Dan Beam 2017/02/11 01:09:27 never hit
96 else
97 this.onDeleteMultipleSites_();
98 this.$.confirmDeleteDialog.close(); 90 this.$.confirmDeleteDialog.close();
99 },
100 91
101 /**
102 * Deletes all site data for a given site.
103 * @private
104 */
105 onDeleteSite_: function() {
Dan Beam 2017/02/11 01:09:27 never hit
106 this.browserProxy.removeCookie(this.idToDelete_);
107 },
108
109 /**
110 * Deletes site data for multiple sites.
111 * @private
112 */
113 onDeleteMultipleSites_: function() {
114 if (this.filterString_.length == 0) { 92 if (this.filterString_.length == 0) {
115 this.removeAllCookies(); 93 this.removeAllCookies();
116 } else { 94 } else {
117 var items = this.$.list.items; 95 var items = this.$.list.items;
118 for (var i = 0; i < items.length; ++i) { 96 for (var i = 0; i < items.length; ++i) {
119 if (this.showItem_(items[i])) 97 if (this.showItem_(items[i]))
120 this.browserProxy.removeCookie(items[i].id); 98 this.browserProxy.removeCookie(items[i].id);
121 } 99 }
122 // We just deleted all items found by the filter, let's reset the filter. 100 // We just deleted all items found by the filter, let's reset the filter.
123 /** @type {SettingsSubpageSearchElement} */(this.$.filter).setValue(''); 101 /** @type {SettingsSubpageSearchElement} */(this.$.filter).setValue('');
124 } 102 }
125 }, 103 },
126 104
127 /** 105 /**
106 * Deletes all site data for a given site.
107 * @param {Event} e
dpapad 2017/02/10 02:14:51 Nit: !Event
Dan Beam 2017/02/11 01:09:27 Done.
108 * @private
109 */
110 onRemoveSiteTap_: function(e) {
111 e.stopPropagation();
112 this.browserProxy.removeCookie(e.model.item.id);
113 },
114
115 /**
128 * @param {!{model: !{item: CookieDataSummaryItem}}} event 116 * @param {!{model: !{item: CookieDataSummaryItem}}} event
129 * @private 117 * @private
130 */ 118 */
131 onSiteTap_: function(event) { 119 onSiteTap_: function(event) {
132 settings.navigateTo(settings.Route.SITE_SETTINGS_DATA_DETAILS, 120 settings.navigateTo(settings.Route.SITE_SETTINGS_DATA_DETAILS,
133 new URLSearchParams('site=' + event.model.item.site)); 121 new URLSearchParams('site=' + event.model.item.site));
134 }, 122 },
135 }); 123 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_data.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698