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

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

Issue 2338133008: [MD settings] Page title in site details through direct link (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 * @param {string} setting 434 * @param {string} setting
435 * @return {boolean} 435 * @return {boolean}
436 * @private 436 * @private
437 */ 437 */
438 computeIsSettingEnabled: function(category, setting) { 438 computeIsSettingEnabled: function(category, setting) {
439 // FullScreen is Allow vs. Ask. 439 // FullScreen is Allow vs. Ask.
440 return category == settings.ContentSettingsTypes.FULLSCREEN ? 440 return category == settings.ContentSettingsTypes.FULLSCREEN ?
441 setting != settings.PermissionValues.ASK : 441 setting != settings.PermissionValues.ASK :
442 setting != settings.PermissionValues.BLOCK; 442 setting != settings.PermissionValues.BLOCK;
443 }, 443 },
444
445 /**
446 * Converts a string origin/pattern to a URL.
447 * @param {string} originOrPattern The origin/pattern to convert to URL.
448 * @return {URL} The URL to return (or null if origin is not a valid URL).
449 * @private
450 */
451 toUrl: function(originOrPattern) {
452 if (originOrPattern.length == 0)
453 return null;
454 // TODO(finnur): Hmm, it would probably be better to ensure scheme on the
455 // JS/C++ boundary.
456 // TODO(dschuyler): I agree. This filtering should be done in one go, rather
457 // that during the sort. The URL generation should be wrapped in a try/catch
458 // as well.
459 originOrPattern = originOrPattern.replace('*://', '');
460 originOrPattern = originOrPattern.replace('[*.]', '');
461 return new URL(this.ensureUrlHasScheme(originOrPattern));
462 },
463
464 /**
465 * Convert an exception (received from the C++ handler) to a full
466 * SiteException.
467 * @param {!Object} exception The raw site exception from C++.
468 * @return {SiteException} The expanded (full) SiteException.
469 * @private
470 */
471 expandSiteException: function(exception) {
472 var origin = exception.origin;
473 var originForDisplay = this.sanitizePort(this.toUrl(origin).origin);
474
475 var embeddingOrigin = exception.embeddingOrigin;
476 var embeddingOriginForDisplay = '';
477 if (origin != embeddingOrigin) {
478 embeddingOriginForDisplay =
479 this.getEmbedderString(embeddingOrigin, this.category);
480 }
481
482 return {
483 origin: origin,
484 originForDisplay: originForDisplay,
485 embeddingOrigin: embeddingOrigin,
486 embeddingOriginForDisplay: embeddingOriginForDisplay,
487 incognito: exception.incognito,
488 setting: exception.setting,
489 source: exception.source,
490 };
491 },
492
444 }; 493 };
445 494
446 /** @polymerBehavior */ 495 /** @polymerBehavior */
447 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; 496 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl];
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698