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

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

Issue 2269963003: Site Settings Desktop: Fix bug with deleting manually added exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback 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 Behavior common to Site Settings classes. 6 * @fileoverview Behavior common to Site Settings classes.
7 */ 7 */
8 8
9 /** @polymerBehavior */ 9 /** @polymerBehavior */
10 var SiteSettingsBehaviorImpl = { 10 var SiteSettingsBehaviorImpl = {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 390 }
391 return url; 391 return url;
392 }, 392 },
393 393
394 /** 394 /**
395 * Adds the wildcard prefix to a pattern string. 395 * Adds the wildcard prefix to a pattern string.
396 * @param {string} pattern The pattern to add the wildcard to. 396 * @param {string} pattern The pattern to add the wildcard to.
397 * @return {string} The resulting pattern. 397 * @return {string} The resulting pattern.
398 * @private 398 * @private
399 */ 399 */
400 addPatternWildcard_: function(pattern) { 400 addPatternWildcard: function(pattern) {
401 if (pattern.startsWith('http://')) 401 if (pattern.startsWith('http://'))
402 return pattern.replace('http://', 'http://[*.]'); 402 return pattern.replace('http://', 'http://[*.]');
403 else if (pattern.startsWith('https://')) 403 else if (pattern.startsWith('https://'))
404 return pattern.replace('https://', 'https://[*.]'); 404 return pattern.replace('https://', 'https://[*.]');
405 else 405 else
406 return '[*.]' + pattern; 406 return '[*.]' + pattern;
407 }, 407 },
408 408
409 /** 409 /**
410 * Removes the wildcard prefix from a pattern string. 410 * Removes the wildcard prefix from a pattern string.
411 * @param {string} pattern The pattern to remove the wildcard from. 411 * @param {string} pattern The pattern to remove the wildcard from.
412 * @return {string} The resulting pattern. 412 * @return {string} The resulting pattern.
413 * @private 413 * @private
414 */ 414 */
415 removePatternWildcard_: function(pattern) { 415 removePatternWildcard: function(pattern) {
416 if (pattern.startsWith('http://[*.]')) 416 if (pattern.startsWith('http://[*.]'))
417 return pattern.replace('http://[*.]', 'http://'); 417 return pattern.replace('http://[*.]', 'http://');
418 else if (pattern.startsWith('https://[*.]')) 418 else if (pattern.startsWith('https://[*.]'))
419 return pattern.replace('https://[*.]', 'https://'); 419 return pattern.replace('https://[*.]', 'https://');
420 else if (pattern.startsWith('[*.]')) 420 else if (pattern.startsWith('[*.]'))
421 return pattern.substring(4, pattern.length); 421 return pattern.substring(4, pattern.length);
422 return pattern; 422 return pattern;
423 }, 423 },
424 424
425 /** 425 /**
426 * Looks up the human-friendly embedder string to show in the UI.
427 * @param {string} embeddingOrigin The embedding origin to show.
428 * @param {string} category The category requesting it.
429 * @return {string} The string to show.
430 */
431 getEmbedderString: function(embeddingOrigin, category) {
432 if (embeddingOrigin == '') {
433 if (category != settings.ContentSettingsTypes.GEOLOCATION)
434 return '';
435 return loadTimeData.getStringF('embeddedOnHost', '*');
436 }
437 return loadTimeData.getStringF(
438 'embeddedOnHost', this.sanitizePort(embeddingOrigin));
439 },
440
441 /**
426 * Returns the icon to use for a given site. 442 * Returns the icon to use for a given site.
427 * @param {string} site The url of the site to fetch the icon for. 443 * @param {string} site The url of the site to fetch the icon for.
428 * @return {string} The background-image style with the favicon. 444 * @return {string} The background-image style with the favicon.
429 * @private 445 * @private
430 */ 446 */
431 computeSiteIcon: function(site) { 447 computeSiteIcon: function(site) {
432 var url = this.ensureUrlHasScheme(site); 448 var url = this.ensureUrlHasScheme(site);
433 return 'background-image: ' + cr.icon.getFaviconImageSet(url); 449 return 'background-image: ' + cr.icon.getFaviconImageSet(url);
434 }, 450 },
435 }; 451 };
436 452
437 /** @polymerBehavior */ 453 /** @polymerBehavior */
438 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; 454 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698