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

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

Issue 2381583002: Site Settings Desktop: Better support for chrome-extension scheme. (Closed)
Patch Set: Add test 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
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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 * @return {string} The resulting pattern. 374 * @return {string} The resulting pattern.
375 * @private 375 * @private
376 */ 376 */
377 addPatternWildcard: function(pattern) { 377 addPatternWildcard: function(pattern) {
378 if (pattern.indexOf('[*.]') > -1) 378 if (pattern.indexOf('[*.]') > -1)
379 return pattern; 379 return pattern;
380 if (pattern.startsWith('http://')) 380 if (pattern.startsWith('http://'))
381 return pattern.replace('http://', 'http://[*.]'); 381 return pattern.replace('http://', 'http://[*.]');
382 else if (pattern.startsWith('https://')) 382 else if (pattern.startsWith('https://'))
383 return pattern.replace('https://', 'https://[*.]'); 383 return pattern.replace('https://', 'https://[*.]');
384 else if (pattern.startsWith('chrome-extension://'))
385 return pattern; // No need for a wildcard for this.
384 else 386 else
385 return '[*.]' + pattern; 387 return '[*.]' + pattern;
386 }, 388 },
387 389
388 /** 390 /**
389 * Removes the wildcard prefix from a pattern string. 391 * Removes the wildcard prefix from a pattern string.
390 * @param {string} pattern The pattern to remove the wildcard from. 392 * @param {string} pattern The pattern to remove the wildcard from.
391 * @return {string} The resulting pattern. 393 * @return {string} The resulting pattern.
392 * @private 394 * @private
393 */ 395 */
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 476
475 /** 477 /**
476 * Convert an exception (received from the C++ handler) to a full 478 * Convert an exception (received from the C++ handler) to a full
477 * SiteException. 479 * SiteException.
478 * @param {!Object} exception The raw site exception from C++. 480 * @param {!Object} exception The raw site exception from C++.
479 * @return {SiteException} The expanded (full) SiteException. 481 * @return {SiteException} The expanded (full) SiteException.
480 * @private 482 * @private
481 */ 483 */
482 expandSiteException: function(exception) { 484 expandSiteException: function(exception) {
483 var origin = exception.origin; 485 var origin = exception.origin;
484 var originForDisplay = this.sanitizePort(this.toUrl(origin).origin); 486 var url = this.toUrl(origin);
487 var originForDisplay = url ? this.sanitizePort(url.origin) : origin;
485 488
486 var embeddingOrigin = exception.embeddingOrigin; 489 var embeddingOrigin = exception.embeddingOrigin;
487 var embeddingOriginForDisplay = ''; 490 var embeddingOriginForDisplay = '';
488 if (origin != embeddingOrigin) { 491 if (origin != embeddingOrigin) {
489 embeddingOriginForDisplay = 492 embeddingOriginForDisplay =
490 this.getEmbedderString(embeddingOrigin, this.category); 493 this.getEmbedderString(embeddingOrigin, this.category);
491 } 494 }
492 495
493 return { 496 return {
494 origin: origin, 497 origin: origin,
495 originForDisplay: originForDisplay, 498 originForDisplay: originForDisplay,
496 embeddingOrigin: embeddingOrigin, 499 embeddingOrigin: embeddingOrigin,
497 embeddingOriginForDisplay: embeddingOriginForDisplay, 500 embeddingOriginForDisplay: embeddingOriginForDisplay,
498 incognito: exception.incognito, 501 incognito: exception.incognito,
499 setting: exception.setting, 502 setting: exception.setting,
500 source: exception.source, 503 source: exception.source,
501 }; 504 };
502 }, 505 },
503 506
504 }; 507 };
505 508
506 /** @polymerBehavior */ 509 /** @polymerBehavior */
507 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; 510 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl];
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/site_list_tests.js » ('j') | chrome/test/data/webui/settings/site_list_tests.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698