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

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

Issue 2354313002: Site Settings Desktop: Flesh out controlled exceptions a little more. (Closed)
Patch Set: Polish Created 4 years, 3 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 * 'site-list' shows a list of Allowed and Blocked sites for a given 7 * 'site-list' shows a list of Allowed and Blocked sites for a given
8 * category. 8 * category.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (othersExists) 179 if (othersExists)
180 return; 180 return;
181 this.$.category.opened = true; 181 this.$.category.opened = true;
182 }.bind(this)); 182 }.bind(this));
183 } else { 183 } else {
184 this.$.category.opened = true; 184 this.$.category.opened = true;
185 } 185 }
186 }, 186 },
187 187
188 /** 188 /**
189 * @param {string} source Where the setting came from. 189 * Returns which icon, if any, should represent the fact that this exception
190 * @return {boolean} 190 * is controlled.
191 * @private 191 * @param {!SiteException} item The item from the list we're computing the
192 * icon for.
193 * @return {string} The icon to show (or blank, if none).
192 */ 194 */
193 isPolicyControlled_: function(source) { 195 computeIconControlledBy_: function(item) {
194 return source == 'policy'; 196 if (item.source == 'extension')
197 return 'cr:extension';
198 if (item.source == 'HostedApp')
199 return 'cr:extension';
200 if (item.source == 'platform_app')
201 return 'cr:extension';
202 if (item.source == 'policy')
203 return 'cr:domain';
204 return '';
dschuyler 2016/09/21 17:25:20 optional: A handful of conditionals is not a big d
Finnur 2016/09/22 12:58:00 Done.
195 }, 205 },
196 206
197 /** 207 /**
198 * @param {string} source Where the setting came from. 208 * @param {string} source Where the setting came from.
199 * @return {boolean} 209 * @return {boolean}
200 * @private 210 * @private
201 */ 211 */
202 shouldShowMenu_: function(source) { 212 shouldShowMenu_: function(source) {
203 return !(this.isPolicyControlled_(source) || this.allSites); 213 return !(this.isExceptionControlled_(source) || this.allSites);
204 }, 214 },
205 215
206 /** 216 /**
207 * Makes sure the visibility is correct for this widget. 217 * Makes sure the visibility is correct for this widget.
208 * @private 218 * @private
209 */ 219 */
210 updateCategoryVisibility_: function() { 220 updateCategoryVisibility_: function() {
211 this.$.category.hidden = 221 this.$.category.hidden =
212 !this.showSiteList_(this.sites, this.categoryEnabled); 222 !this.showSiteList_(this.sites, this.categoryEnabled);
213 }, 223 },
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 406
397 return this.showSessionOnlyAction_; 407 return this.showSessionOnlyAction_;
398 }, 408 },
399 409
400 /** 410 /**
401 * A handler for selecting a site (by clicking on the origin). 411 * A handler for selecting a site (by clicking on the origin).
402 * @private 412 * @private
403 */ 413 */
404 onOriginTap_: function(event) { 414 onOriginTap_: function(event) {
405 this.selectedSite = event.model.item; 415 this.selectedSite = event.model.item;
406 if (this.isPolicyControlled_(this.selectedSite.source))
407 return;
Finnur 2016/09/21 16:45:24 I took this out because it doesn't make sense to m
dschuyler 2016/09/21 17:25:20 Acknowledged.
408
409 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS, 416 settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS,
410 new URLSearchParams('site=' + this.selectedSite.origin)); 417 new URLSearchParams('site=' + this.selectedSite.origin));
411 }, 418 },
412 419
413 /** 420 /**
414 * A handler for activating one of the menu action items. 421 * A handler for activating one of the menu action items.
415 * @param {!{model: !{item: !{origin: string}}, 422 * @param {!{model: !{item: !{origin: string}},
416 * detail: !{selected: string}}} event 423 * detail: !{selected: string}}} event
417 * @private 424 * @private
418 */ 425 */
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // is redundant to also list all the sites that are blocked. 507 // is redundant to also list all the sites that are blocked.
501 if (this.isAllowList_()) 508 if (this.isAllowList_())
502 return true; 509 return true;
503 510
504 if (this.isSessionOnlyList_()) 511 if (this.isSessionOnlyList_())
505 return siteList.length > 0; 512 return siteList.length > 0;
506 513
507 return toggleState; 514 return toggleState;
508 }, 515 },
509 }); 516 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698