OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 */ | 64 */ |
65 reloadCookies_: function() { | 65 reloadCookies_: function() { |
66 this.browserProxy.reloadCookies().then(function(list) { | 66 this.browserProxy.reloadCookies().then(function(list) { |
67 this.loadChildren_(list); | 67 this.loadChildren_(list); |
68 }.bind(this)); | 68 }.bind(this)); |
69 }, | 69 }, |
70 | 70 |
71 /** | 71 /** |
72 * A filter function for the list. | 72 * A filter function for the list. |
73 * @param {!CookieDataSummaryItem} item The item to possibly filter out. | 73 * @param {!CookieDataSummaryItem} item The item to possibly filter out. |
74 * @return {!boolean} Whether to show the item. | 74 * @return {boolean} Whether to show the item. |
75 * @private | 75 * @private |
76 */ | 76 */ |
77 showItem_: function(item) { | 77 showItem_: function(item) { |
78 if (this.filterString_.length == 0) | 78 if (this.filterString_.length == 0) |
79 return true; | 79 return true; |
80 return item.site.indexOf(this.filterString_) > -1; | 80 return item.site.indexOf(this.filterString_) > -1; |
81 }, | 81 }, |
82 | 82 |
83 /** @private */ | 83 /** @private */ |
84 onSearchChanged_: function(e) { | 84 onSearchChanged_: function(e) { |
85 this.filterString_ = e.detail; | 85 this.filterString_ = e.detail; |
86 this.$.list.render(); | 86 this.$.list.render(); |
87 }, | 87 }, |
88 | 88 |
89 /** @private */ | 89 /** @private */ |
90 isRemoveButtonVisible_: function(sites, renderedItemCount) { | 90 isRemoveButtonVisible_: function(sites, renderedItemCount) { |
91 return renderedItemCount != 0; | 91 return renderedItemCount != 0; |
92 }, | 92 }, |
93 | 93 |
94 /** | 94 /** |
95 * Returns the string to use for the Remove label. | 95 * Returns the string to use for the Remove label. |
96 * @return {!string} filterString The current filter string. | 96 * @return {string} filterString The current filter string. |
97 * @private | 97 * @private |
98 */ | 98 */ |
99 computeRemoveLabel_: function(filterString) { | 99 computeRemoveLabel_: function(filterString) { |
100 if (filterString.length == 0) | 100 if (filterString.length == 0) |
101 return loadTimeData.getString('siteSettingsCookieRemoveAll'); | 101 return loadTimeData.getString('siteSettingsCookieRemoveAll'); |
102 return loadTimeData.getString('siteSettingsCookieRemoveAllShown'); | 102 return loadTimeData.getString('siteSettingsCookieRemoveAllShown'); |
103 }, | 103 }, |
104 | 104 |
105 /** | 105 /** |
106 * Called when the cookie list is ready to be shown. | 106 * Called when the cookie list is ready to be shown. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this.treeNodes_.removeByParentId(args.id, args.start, args.count); | 150 this.treeNodes_.removeByParentId(args.id, args.start, args.count); |
151 this.sites = this.treeNodes_.getSummaryList(); | 151 this.sites = this.treeNodes_.getSummaryList(); |
152 }, | 152 }, |
153 | 153 |
154 /** @private */ | 154 /** @private */ |
155 onCloseDialog_: function() { | 155 onCloseDialog_: function() { |
156 this.$.confirmDeleteDialog.close(); | 156 this.$.confirmDeleteDialog.close(); |
157 }, | 157 }, |
158 | 158 |
159 /** | 159 /** |
160 * Shows a dialog to confirm the deletion of a site. | |
161 * @param {!{model: !{item: CookieDataSummaryItem}}} event | |
162 * @private | |
163 */ | |
164 onConfirmDeleteSite_: function(event) { | |
165 this.idToDelete_ = event.model.item.id; | |
166 this.confirmationDeleteMsg_ = loadTimeData.getStringF( | |
167 'siteSettingsCookieRemoveConfirmation', event.model.item.site); | |
168 this.$.confirmDeleteDialog.showModal(); | |
169 }, | |
170 | |
171 /** | |
172 * Shows a dialog to confirm the deletion of multiple sites. | 160 * Shows a dialog to confirm the deletion of multiple sites. |
173 * @private | 161 * @private |
174 */ | 162 */ |
175 onConfirmDeleteMultipleSites_: function() { | 163 onConfirmDeleteMultipleSites_: function() { |
176 this.idToDelete_ = ''; // Delete all. | 164 this.idToDelete_ = ''; // Delete all. |
177 this.confirmationDeleteMsg_ = loadTimeData.getString( | 165 this.confirmationDeleteMsg_ = loadTimeData.getString( |
178 'siteSettingsCookieRemoveMultipleConfirmation'); | 166 'siteSettingsCookieRemoveMultipleConfirmation'); |
179 this.$.confirmDeleteDialog.showModal(); | 167 this.$.confirmDeleteDialog.showModal(); |
180 }, | 168 }, |
181 | 169 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 this.shadowRoot.appendChild(dialog); | 215 this.shadowRoot.appendChild(dialog); |
228 | 216 |
229 var node = this.treeNodes_.fetchNodeById(event.model.item.id, false); | 217 var node = this.treeNodes_.fetchNodeById(event.model.item.id, false); |
230 dialog.open(node); | 218 dialog.open(node); |
231 | 219 |
232 dialog.addEventListener('close', function(event) { | 220 dialog.addEventListener('close', function(event) { |
233 dialog.remove(); | 221 dialog.remove(); |
234 }); | 222 }); |
235 }, | 223 }, |
236 }); | 224 }); |
OLD | NEW |