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

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

Issue 2379913003: Site Settings Desktop: Polish the Site Data details dialog. (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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_data_details_dialog.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-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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 */ 50 */
51 open: function(site) { 51 open: function(site) {
52 this.site_ = site; 52 this.site_ = site;
53 this.populateDialog_(); 53 this.populateDialog_();
54 this.listener_ = cr.addWebUIListener( 54 this.listener_ = cr.addWebUIListener(
55 'onTreeItemRemoved', this.onTreeItemRemoved_.bind(this)); 55 'onTreeItemRemoved', this.onTreeItemRemoved_.bind(this));
56 this.$.dialog.showModal(); 56 this.$.dialog.showModal();
57 }, 57 },
58 58
59 /** 59 /**
60 * Closes the dialog, if open.
61 */
62 close: function() {
63 var dialog = /** @type {!CrDialogElement} */(this.$.dialog);
64 if (dialog.open)
65 dialog.close();
66 },
67
68 /**
60 * Populates the dialog with the data about the site. 69 * Populates the dialog with the data about the site.
61 * @private 70 * @private
62 */ 71 */
63 populateDialog_: function() { 72 populateDialog_: function() {
64 this.title_ = loadTimeData.getStringF('siteSettingsCookieDialog', 73 this.title_ = loadTimeData.getStringF('siteSettingsCookieDialog',
65 this.site_.data_.title); 74 this.site_.data_.title);
66 75
67 this.entries_ = this.site_.getCookieList(); 76 this.entries_ = this.site_.getCookieList();
68 if (this.entries_.length < 2) { 77 if (this.entries_.length < 2) {
69 // When there's only one item to show, hide the picker and change the 78 // When there's only one item to show, hide the picker and change the
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 site.addCookieData(root, node); 130 site.addCookieData(root, node);
122 }, 131 },
123 132
124 /** 133 /**
125 * Called when a single item has been removed. 134 * Called when a single item has been removed.
126 * @param {!CookieRemovePacket} args The details about what to remove. 135 * @param {!CookieRemovePacket} args The details about what to remove.
127 * @private 136 * @private
128 */ 137 */
129 onTreeItemRemoved_: function(args) { 138 onTreeItemRemoved_: function(args) {
130 this.entries_ = this.site_.getCookieList(); 139 this.entries_ = this.site_.getCookieList();
131 if (args.id == this.site_.data_.id || this.entries_.length == 0) { 140 if (this.site_.children_.length == 0 || this.entries_.length == 0) {
132 this.$.dialog.close(); 141 this.close();
133 return; 142 return;
134 } 143 }
135 144
136 if (this.entries_.length <= this.lastSelectedIndex_) 145 if (this.entries_.length <= this.lastSelectedIndex_)
137 this.lastSelectedIndex_ = this.entries_.length - 1; 146 this.lastSelectedIndex_ = this.entries_.length - 1;
138 var selectedId = this.entries_[this.lastSelectedIndex_].id; 147 var selectedId = this.entries_[this.lastSelectedIndex_].id;
139 this.$.picker.selected = selectedId; 148 this.$.picker.selected = selectedId;
140 this.populateItem_(selectedId, this.site_); 149 this.populateItem_(selectedId, this.site_);
141 }, 150 },
142 151
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 this.site_, this.site_.data_.id, this.$.picker.selected)); 185 this.site_, this.site_.data_.id, this.$.picker.selected));
177 }, 186 },
178 187
179 /** 188 /**
180 * A handler for when the user opts to remove all cookies. 189 * A handler for when the user opts to remove all cookies.
181 * @private 190 * @private
182 */ 191 */
183 onRemoveAll_: function(event) { 192 onRemoveAll_: function(event) {
184 cr.removeWebUIListener(this.listener_); 193 cr.removeWebUIListener(this.listener_);
185 this.browserProxy.removeCookie(this.site_.data_.id); 194 this.browserProxy.removeCookie(this.site_.data_.id);
186 this.$.dialog.close(); 195 this.close();
187 }, 196 },
188 197
189 /** @private */ 198 /** @private */
190 onCancelTap_: function() { 199 onCancelTap_: function() {
191 this.$.dialog.cancel(); 200 this.$.dialog.cancel();
192 }, 201 },
193 }); 202 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_data_details_dialog.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698