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

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

Issue 2370843002: Site Settings Desktop: Only show Remove action if filter hasn't removed all. (Closed)
Patch Set: 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
« 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({
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 showItem_: function(item) { 67 showItem_: function(item) {
68 if (this.filterString_.length == 0) 68 if (this.filterString_.length == 0)
69 return true; 69 return true;
70 return item.site.indexOf(this.filterString_) > -1; 70 return item.site.indexOf(this.filterString_) > -1;
71 }, 71 },
72 72
73 /** @private */ 73 /** @private */
74 onSearchChanged_: function(e) { 74 onSearchChanged_: function(e) {
75 this.filterString_ = e.detail; 75 this.filterString_ = e.detail;
76 this.$.list.render(); 76 this.$.list.render();
77
78 // There seems to be a bug in renderedItemCount where it is always 0 after
tommycli 2016/09/26 23:01:34 why move this code from the computed binding? Wou
Finnur 2016/09/27 14:14:34 Good question. I tried both ways before and this i
79 // the list has been rendered initially (with no filter string applied), but
80 // then renderedItemCount matches the total |sites| count anyway.
81 if (this.filterString_ == '')
82 this.$.remove.hidden = this.sites.length == 0;
83 else
84 this.$.remove.hidden = this.$.list['renderedItemCount'] == 0;
tommycli 2016/09/26 23:01:34 list.renderedItemCount?
Dan Beam 2016/09/27 00:12:27 this is why: https://build.chromium.org/p/tryserve
Finnur 2016/09/27 14:14:34 Yup. Dan hit the nail on the head, but it is all m
77 }, 85 },
78 86
79 /** 87 /**
80 * Returns whether remove all should be shown.
81 * @param {!Array<!CookieDataSummaryItem>} sites The sites list to use to
82 * determine whether the button should be visible.
83 * @private
84 */
85 removeAllIsVisible_: function(sites) {
86 return sites.length > 0;
87 },
88
89 /**
90 * Returns the string to use for the Remove label. 88 * Returns the string to use for the Remove label.
91 * @return {!string} filterString The current filter string. 89 * @return {!string} filterString The current filter string.
92 * @private 90 * @private
93 */ 91 */
94 computeRemoveLabel_: function(filterString) { 92 computeRemoveLabel_: function(filterString) {
95 if (filterString.length == 0) 93 if (filterString.length == 0)
96 return loadTimeData.getString('siteSettingsCookieRemoveAll'); 94 return loadTimeData.getString('siteSettingsCookieRemoveAll');
97 return loadTimeData.getString('siteSettingsCookieRemoveAllShown'); 95 return loadTimeData.getString('siteSettingsCookieRemoveAllShown');
98 }, 96 },
99 97
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 this.shadowRoot.appendChild(dialog); 180 this.shadowRoot.appendChild(dialog);
183 181
184 var node = this.treeNodes_.fetchNodeById(event.model.item.id, false); 182 var node = this.treeNodes_.fetchNodeById(event.model.item.id, false);
185 dialog.open(node); 183 dialog.open(node);
186 184
187 dialog.addEventListener('close', function(event) { 185 dialog.addEventListener('close', function(event) {
188 dialog.remove(); 186 dialog.remove();
189 }); 187 });
190 }, 188 },
191 }); 189 });
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