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_list.js

Issue 2044963003: Site Settings Desktop: Change how adding site exceptions work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * 'settings-site-list' shows a list of Allowed and Blocked sites for a given 7 * 'settings-site-list' shows a list of Allowed and Blocked sites for a given
8 * category. 8 * category.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (allowExists) 165 if (allowExists)
166 return; 166 return;
167 this.$.category.opened = true; 167 this.$.category.opened = true;
168 }.bind(this)); 168 }.bind(this));
169 } else { 169 } else {
170 this.$.category.opened = true; 170 this.$.category.opened = true;
171 } 171 }
172 }, 172 },
173 173
174 /** 174 /**
175 * Makes sure the visibility is correct for this widget (e.g. hidden if the 175 * Makes sure the visibility is correct for this widget.
176 * block list is empty).
177 * @private 176 * @private
178 */ 177 */
179 updateCategoryVisibility_: function() { 178 updateCategoryVisibility_: function() {
180 this.$.category.hidden = 179 this.$.category.hidden = !this.showSiteList_(this.categoryEnabled);
181 !this.showSiteList_(this.sites, this.categoryEnabled);
182 }, 180 },
183 181
184 /** 182 /**
183 * A handler for the Add Site button.
184 * @private
185 */
186 onAddSiteTap_: function() {
187 var dialog = document.createElement('add-site-dialog');
188 dialog.category = this.category;
189 this.shadowRoot.appendChild(dialog);
190
191 dialog.open(this.categorySubtype);
192
193 dialog.addEventListener('iron-overlay-closed', function() {
194 dialog.remove();
195 });
196 },
197
198 /**
185 * Handles the expanding and collapsing of the sites list. 199 * Handles the expanding and collapsing of the sites list.
186 * @private 200 * @private
187 */ 201 */
188 onToggle_: function(e) { 202 onToggle_: function(e) {
189 if (this.$.category.opened) 203 if (this.$.category.opened)
190 this.$.icon.icon = 'cr:expand-less'; 204 this.$.icon.icon = 'cr:expand-less';
191 else 205 else
192 this.$.icon.icon = 'cr:expand-more'; 206 this.$.icon.icon = 'cr:expand-more';
193 }, 207 },
194 208
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 /** 441 /**
428 * Returns true if this widget is showing the allow list. 442 * Returns true if this widget is showing the allow list.
429 * @private 443 * @private
430 */ 444 */
431 isAllowList_: function() { 445 isAllowList_: function() {
432 return this.categorySubtype == settings.PermissionValues.ALLOW; 446 return this.categorySubtype == settings.PermissionValues.ALLOW;
433 }, 447 },
434 448
435 /** 449 /**
436 * Returns whether to show the site list. 450 * Returns whether to show the site list.
437 * @param {Array} siteList The list of all sites to display for this category
438 * subtype.
439 * @param {boolean} toggleState The state of the global toggle for this 451 * @param {boolean} toggleState The state of the global toggle for this
440 * category. 452 * category.
441 * @private 453 * @private
442 */ 454 */
443 showSiteList_: function(siteList, toggleState) { 455 showSiteList_: function(toggleState) {
444 if (siteList.length == 0)
445 return false;
446
447 // The Block list is only shown when the category is set to Allow since it 456 // The Block list is only shown when the category is set to Allow since it
448 // is redundant to also list all the sites that are blocked. 457 // is redundant to also list all the sites that are blocked.
449 if (this.isAllowList_()) 458 if (this.isAllowList_())
450 return true; 459 return true;
451 460
452 return toggleState; 461 return toggleState;
453 }, 462 },
454 }); 463 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698