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

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

Issue 2391253002: Site Settings Desktop: Polish the Site Data section. (Closed)
Patch Set: Address feedback Created 4 years, 2 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 // 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-details-dialog' provides a dialog to show details of site data 7 * 'site-data-details-dialog' provides a dialog to show details of site data
8 * stored by a given site. 8 * stored by a given site.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 15 matching lines...) Expand all
26 site_: Object, 26 site_: Object,
27 27
28 /** 28 /**
29 * The cookie entries for the given site. 29 * The cookie entries for the given site.
30 * @type {!Array<!CookieDataItem>} 30 * @type {!Array<!CookieDataItem>}
31 * @private 31 * @private
32 */ 32 */
33 entries_: Array, 33 entries_: Array,
34 34
35 /** 35 /**
36 * The cookie nodes to show in the dialog.
37 * @type {!Array<CookieDataForDisplay>}
38 * @private
39 */
40 cookieNodes_: Object,
41
42 /**
36 * The index of the last selected item. 43 * The index of the last selected item.
37 */ 44 */
38 lastSelectedIndex_: Number, 45 lastSelectedIndex_: Number,
39 46
40 /** 47 /**
41 * Our WebUI listener. 48 * Our WebUI listener.
42 * @type {?WebUIListener} 49 * @type {?WebUIListener}
43 */ 50 */
44 listener_: Object, 51 listener_: Object,
45 }, 52 },
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return ''; 118 return '';
112 }, 119 },
113 120
114 /** 121 /**
115 * Add the cookie data to the content section of this dialog. 122 * Add the cookie data to the content section of this dialog.
116 * @param {string} id The id of the cookie node to display. 123 * @param {string} id The id of the cookie node to display.
117 * @param {!settings.CookieTreeNode} site The current site. 124 * @param {!settings.CookieTreeNode} site The current site.
118 * @private 125 * @private
119 */ 126 */
120 populateItem_: function(id, site) { 127 populateItem_: function(id, site) {
121 // Out with the old...
122 var root = this.$.content;
123 while (root.lastChild) {
124 root.removeChild(root.lastChild);
125 }
126
127 // In with the new... 128 // In with the new...
dschuyler 2016/10/07 21:14:48 Heh, the comment seems lost without the comment ab
Finnur 2016/10/10 09:56:55 Indeed. Removed.
128 var node = site.fetchNodeById(id, true); 129 var node = site.fetchNodeById(id, true);
129 if (node) 130 if (node)
130 site.addCookieData(root, node); 131 this.cookieNodes_ = site.getCookieData(node);
131 }, 132 },
132 133
133 /** 134 /**
134 * Called when a single item has been removed. 135 * Called when a single item has been removed.
135 * @param {!CookieRemovePacket} args The details about what to remove. 136 * @param {!CookieRemovePacket} args The details about what to remove.
136 * @private 137 * @private
137 */ 138 */
138 onTreeItemRemoved_: function(args) { 139 onTreeItemRemoved_: function(args) {
139 this.entries_ = this.site_.getCookieList(); 140 this.entries_ = this.site_.getCookieList();
140 if (this.site_.children_.length == 0 || this.entries_.length == 0) { 141 if (this.site_.children_.length == 0 || this.entries_.length == 0) {
(...skipping 24 matching lines...) Expand all
165 break; 166 break;
166 } 167 }
167 } 168 }
168 }, 169 },
169 170
170 getEntryDescription: function(item) { 171 getEntryDescription: function(item) {
171 // Frequently there are multiple cookies per site. To avoid showing a list 172 // Frequently there are multiple cookies per site. To avoid showing a list
172 // of '1 cookie', '1 cookie', ... etc, it is better to show the title of the 173 // of '1 cookie', '1 cookie', ... etc, it is better to show the title of the
173 // cookie to differentiate them. 174 // cookie to differentiate them.
174 if (item.data.type == 'cookie') 175 if (item.data.type == 'cookie')
175 return item.title; 176 return loadTimeData.getStringF('siteSettingsCookie', item.title);
176 177
177 return getCookieDataCategoryText(item.data.type, item.data.totalUsage); 178 return getCookieDataCategoryText(item.data.type, item.data.totalUsage);
178 }, 179 },
179 180
180 /** 181 /**
181 * A handler for when the user opts to remove a single cookie. 182 * A handler for when the user opts to remove a single cookie.
182 * @private 183 * @private
183 */ 184 */
184 onRemove_: function(event) { 185 onRemove_: function(event) {
185 this.browserProxy.removeCookie(this.nodePath_( 186 this.browserProxy.removeCookie(this.nodePath_(
186 this.site_, this.site_.data_.id, this.$.picker.value)); 187 this.site_, this.site_.data_.id, this.$.picker.value));
187 }, 188 },
188 189
189 /** 190 /**
190 * A handler for when the user opts to remove all cookies. 191 * A handler for when the user opts to remove all cookies.
191 * @private 192 * @private
192 */ 193 */
193 onRemoveAll_: function(event) { 194 onRemoveAll_: function(event) {
194 cr.removeWebUIListener(this.listener_); 195 cr.removeWebUIListener(this.listener_);
195 this.browserProxy.removeCookie(this.site_.data_.id); 196 this.browserProxy.removeCookie(this.site_.data_.id);
196 this.close(); 197 this.close();
197 }, 198 },
198 199
199 /** @private */ 200 /** @private */
200 onCancelTap_: function() { 201 onCancelTap_: function() {
201 this.$.dialog.cancel(); 202 this.$.dialog.cancel();
202 }, 203 },
203 }); 204 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698