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

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

Issue 2240023002: [MD settings] extension exceptions in site settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 * Converts a string origin/pattern to a URL. 295 * Converts a string origin/pattern to a URL.
296 * @param {string} originOrPattern The origin/pattern to convert to URL. 296 * @param {string} originOrPattern The origin/pattern to convert to URL.
297 * @return {URL} The URL to return (or null if origin is not a valid URL). 297 * @return {URL} The URL to return (or null if origin is not a valid URL).
298 * @private 298 * @private
299 */ 299 */
300 toUrl_: function(originOrPattern) { 300 toUrl_: function(originOrPattern) {
301 if (originOrPattern.length == 0) 301 if (originOrPattern.length == 0)
302 return null; 302 return null;
303 // TODO(finnur): Hmm, it would probably be better to ensure scheme on the 303 // TODO(finnur): Hmm, it would probably be better to ensure scheme on the
304 // JS/C++ boundary. 304 // JS/C++ boundary.
305 return new URL( 305 // TODO(dschuyler): I agree. This filtering should be done in one go, rather
306 this.ensureUrlHasScheme(originOrPattern.replace('[*.]', ''))); 306 // that during the sort. The URL generation should be wrapped in a try/catch
307 // as well.
Finnur 2016/08/12 15:36:39 Sounds good. On a related note: https://bugs.chro
dschuyler 2016/08/12 19:21:13 Acknowledged.
308 originOrPattern = originOrPattern.replace('*://', '');
309 originOrPattern = originOrPattern.replace('[*.]', '');
310 return new URL(this.ensureUrlHasScheme(originOrPattern));
307 }, 311 },
308 312
309 /** 313 /**
310 * Converts an unordered site list to an ordered array, sorted by site name 314 * Converts an unordered site list to an ordered array, sorted by site name
311 * then protocol and de-duped (by origin). 315 * then protocol and de-duped (by origin).
312 * @param {!Array<SiteException>} sites A list of sites to sort and de-dupe. 316 * @param {!Array<SiteException>} sites A list of sites to sort and de-dupe.
313 * @return {!Array<SiteException>} Sorted and de-duped list. 317 * @return {!Array<SiteException>} Sorted and de-duped list.
314 * @private 318 * @private
315 */ 319 */
316 toSiteArray_: function(sites) { 320 toSiteArray_: function(sites) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // is redundant to also list all the sites that are blocked. 477 // is redundant to also list all the sites that are blocked.
474 if (this.isAllowList_()) 478 if (this.isAllowList_())
475 return true; 479 return true;
476 480
477 if (this.isSessionOnlyList_()) 481 if (this.isSessionOnlyList_())
478 return siteList.length > 0; 482 return siteList.length > 0;
479 483
480 return toggleState; 484 return toggleState;
481 }, 485 },
482 }); 486 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698