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

Unified Diff: chrome/browser/resources/settings/site_settings/site_settings_behavior.js

Issue 2769303004: [MD setting] tool tips on controlledBy site exceptions (Closed)
Patch Set: unit test and review changes Created 3 years, 9 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
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 8551689a6e6c687e409d3204de2833b8317f247b..121f5d66db0ee2ee25c559e8aa0e8e45181ace3c 100644
--- a/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
+++ b/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
@@ -6,6 +6,21 @@
* @fileoverview Behavior common to Site Settings classes.
*/
+
+/**
+ * The source information on site exceptions doesn't exactly match the
+ * controlledBy values.
+ * TODO(dschuyler): Can they be unified (and this dictionary removed)?
+ * @type {!Object}
+ */
+var kControlledByLookup = {
+ 'extension': chrome.settingsPrivate.ControlledBy.EXTENSION,
+ 'HostedApp': chrome.settingsPrivate.ControlledBy.EXTENSION,
+ 'platform_app': chrome.settingsPrivate.ControlledBy.EXTENSION,
+ 'policy': chrome.settingsPrivate.ControlledBy.USER_POLICY,
+};
+
+
/** @polymerBehavior */
var SiteSettingsBehaviorImpl = {
properties: {
@@ -39,7 +54,8 @@ var SiteSettingsBehaviorImpl = {
* @return {string} The URL with a scheme, or an empty string.
*/
ensureUrlHasScheme: function(url) {
- if (url.length == 0) return url;
+ if (url.length == 0)
+ return url;
return url.includes('://') ? url : 'http://' + url;
},
@@ -94,17 +110,6 @@ var SiteSettingsBehaviorImpl = {
},
/**
- * Returns true if this exception is controlled by, for example, a policy or
- * set by an extension.
- * @param {string} source The source controlling the extension
- * @return {boolean} Whether it is being controlled.
- * @protected
- */
- isExceptionControlled_: function(source) {
- return source != undefined && source != 'preference';
- },
-
- /**
* Returns the icon to use for a given site.
* @param {string} site The url of the site to fetch the icon for.
* @return {string} The background-image style with the favicon.
@@ -148,7 +153,7 @@ var SiteSettingsBehaviorImpl = {
* Convert an exception (received from the C++ handler) to a full
* SiteException.
* @param {!RawSiteException} exception The raw site exception from C++.
- * @return {SiteException} The expanded (full) SiteException.
+ * @return {!SiteException} The expanded (full) SiteException.
* @private
*/
expandSiteException: function(exception) {
@@ -160,6 +165,12 @@ var SiteSettingsBehaviorImpl = {
this.getEmbedderString(embeddingOrigin, this.category);
}
+ var enforcement = '';
+ if (exception.source == 'policy' || exception.source == 'extension')
+ enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
+
+ var controlledBy = kControlledByLookup[exception.source] || '';
+
return {
category: this.category,
origin: origin,
@@ -168,7 +179,8 @@ var SiteSettingsBehaviorImpl = {
embeddingDisplayName: embeddingDisplayName,
incognito: exception.incognito,
setting: exception.setting,
- source: exception.source,
+ enforcement: enforcement,
+ controlledBy: controlledBy,
};
},

Powered by Google App Engine
This is Rietveld 408576698