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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/site_settings/site_settings_behavior.js
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_behavior.js b/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
index 7e949361e3175f7ede811eb8e34ce59967a398db..d810c8226962bcf129c71e40301a519caaa345d4 100644
--- a/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
+++ b/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
@@ -441,6 +441,55 @@ var SiteSettingsBehaviorImpl = {
setting != settings.PermissionValues.ASK :
setting != settings.PermissionValues.BLOCK;
},
+
+ /**
+ * Converts a string origin/pattern to a URL.
+ * @param {string} originOrPattern The origin/pattern to convert to URL.
+ * @return {URL} The URL to return (or null if origin is not a valid URL).
+ * @private
+ */
+ toUrl: function(originOrPattern) {
+ if (originOrPattern.length == 0)
+ return null;
+ // TODO(finnur): Hmm, it would probably be better to ensure scheme on the
+ // JS/C++ boundary.
+ // TODO(dschuyler): I agree. This filtering should be done in one go, rather
+ // that during the sort. The URL generation should be wrapped in a try/catch
+ // as well.
+ originOrPattern = originOrPattern.replace('*://', '');
+ originOrPattern = originOrPattern.replace('[*.]', '');
+ return new URL(this.ensureUrlHasScheme(originOrPattern));
+ },
+
+ /**
+ * Convert an exception (received from the C++ handler) to a full
+ * SiteException.
+ * @param {!Object} exception The raw site exception from C++.
+ * @return {SiteException} The expanded (full) SiteException.
+ * @private
+ */
+ expandSiteException: function(exception) {
+ var origin = exception.origin;
+ var originForDisplay = this.sanitizePort(this.toUrl(origin).origin);
+
+ var embeddingOrigin = exception.embeddingOrigin;
+ var embeddingOriginForDisplay = '';
+ if (origin != embeddingOrigin) {
+ embeddingOriginForDisplay =
+ this.getEmbedderString(embeddingOrigin, this.category);
+ }
+
+ return {
+ origin: origin,
+ originForDisplay: originForDisplay,
+ embeddingOrigin: embeddingOrigin,
+ embeddingOriginForDisplay: embeddingOriginForDisplay,
+ incognito: exception.incognito,
+ setting: exception.setting,
+ source: exception.source,
+ };
+ },
+
};
/** @polymerBehavior */
« 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