| 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-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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Store the index of what was selected so we can re-select the next value | 150 // Store the index of what was selected so we can re-select the next value |
| 151 // when things get deleted. | 151 // when things get deleted. |
| 152 for (var i = 0; i < this.entries_.length; ++i) { | 152 for (var i = 0; i < this.entries_.length; ++i) { |
| 153 if (this.entries_[i].data.id == event.detail.selected) { | 153 if (this.entries_[i].data.id == event.detail.selected) { |
| 154 this.lastSelectedIndex_ = i; | 154 this.lastSelectedIndex_ = i; |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 getEntryDescription: function(item) { |
| 161 // Frequently there are multiple cookies per site. To avoid showing a list |
| 162 // of '1 cookie', '1 cookie', ... etc, it is better to show the title of the |
| 163 // cookie to differentiate them. |
| 164 if (item.data.type == 'cookie') |
| 165 return item.title; |
| 166 |
| 167 return getCookieDataCategoryText(item.data.type, item.data.totalUsage); |
| 168 }, |
| 169 |
| 160 /** | 170 /** |
| 161 * A handler for when the user opts to remove a single cookie. | 171 * A handler for when the user opts to remove a single cookie. |
| 162 * @private | 172 * @private |
| 163 */ | 173 */ |
| 164 onRemove_: function(event) { | 174 onRemove_: function(event) { |
| 165 this.browserProxy.removeCookie(this.nodePath_( | 175 this.browserProxy.removeCookie(this.nodePath_( |
| 166 this.site_, this.site_.data_.id, this.$.picker.selected)); | 176 this.site_, this.site_.data_.id, this.$.picker.selected)); |
| 167 }, | 177 }, |
| 168 | 178 |
| 169 /** | 179 /** |
| 170 * A handler for when the user opts to remove all cookies. | 180 * A handler for when the user opts to remove all cookies. |
| 171 * @private | 181 * @private |
| 172 */ | 182 */ |
| 173 onRemoveAll_: function(event) { | 183 onRemoveAll_: function(event) { |
| 174 cr.removeWebUIListener(this.listener_); | 184 cr.removeWebUIListener(this.listener_); |
| 175 this.browserProxy.removeCookie(this.site_.data_.id); | 185 this.browserProxy.removeCookie(this.site_.data_.id); |
| 176 this.$.dialog.close(); | 186 this.$.dialog.close(); |
| 177 }, | 187 }, |
| 178 | 188 |
| 179 /** @private */ | 189 /** @private */ |
| 180 onCancelTap_: function() { | 190 onCancelTap_: function() { |
| 181 this.$.dialog.cancel(); | 191 this.$.dialog.cancel(); |
| 182 }, | 192 }, |
| 183 }); | 193 }); |
| OLD | NEW |