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

Unified Diff: ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js

Issue 2708013003: [MD settings] show icon when content settings are controlled by an extension (Closed)
Patch Set: unit test fix Created 3 years, 10 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: ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js b/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js
index ad393b95b2e21fa3784d71ace175efbc4cc70a50..d153e0a6c12efba2e7af97f241d123a3c0e61d77 100644
--- a/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js
+++ b/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js
@@ -8,21 +8,35 @@
/** @polymerBehavior */
var CrPolicyPrefBehavior = {
+ properties: {
+ /**
+ * Showing that an extension is controlling a pref is sometimes done with a
+ * different UI (e.g. extension-controlled-indicator). In those cases,
+ * avoid showing an (extra) indicator here.
+ * @public
+ */
+ ignoreExtensions: Boolean,
+ },
+
/**
+ * Is the |pref| controlled by something that prevents user control of the
+ * preference.
* @return {boolean} True if |this.pref| is controlled by an enforced policy.
*/
- isPrefPolicyControlled: function() {
- return (
- this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED &&
- this.pref.controlledBy !=
- chrome.settingsPrivate.ControlledBy.EXTENSION);
+ isPrefEnforced: function() {
+ if (this.ignoreExtensions &&
+ this.pref.controlledBy ==
+ chrome.settingsPrivate.ControlledBy.EXTENSION) {
+ return false;
+ }
+ return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED;
},
/**
* @return {boolean} True if |this.pref| has a recommended or enforced policy.
*/
hasPrefPolicyIndicator: function() {
- return this.isPrefPolicyControlled() ||
+ return this.isPrefEnforced() ||
this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED;
},
};

Powered by Google App Engine
This is Rietveld 408576698