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

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

Issue 2479973002: MD Settings: clarify "controlled by" logic (Closed)
Patch Set: merge Created 4 years, 1 month 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 d8897da69b91199f611fccf195fac55a01696e59..2c4a3014ba892ef6a20ed214a20e72d9874891dd 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
@@ -13,31 +13,29 @@ var CrPolicyPrefBehavior = {
* @return {boolean} True if the pref is controlled by an enforced policy.
*/
isPrefPolicyControlled: function(pref) {
- return pref.policyEnforcement ==
- chrome.settingsPrivate.PolicyEnforcement.ENFORCED;
+ return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED &&
+ pref.controlledBy != chrome.settingsPrivate.ControlledBy.EXTENSION;
},
/**
- * @param {chrome.settingsPrivate.PolicySource} source
- * @param {chrome.settingsPrivate.PolicyEnforcement} enforcement
- * @return {CrPolicyIndicatorType} The indicator type based on |source| and
- * |enforcement|.
+ * @param {chrome.settingsPrivate.ControlledBy} controlledBy
+ * @param {chrome.settingsPrivate.Enforcement} enforcement
+ * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy|
+ * and |enforcement|.
*/
- getIndicatorType: function(source, enforcement) {
- if (enforcement == chrome.settingsPrivate.PolicyEnforcement.RECOMMENDED)
+ getIndicatorType: function(controlledBy, enforcement) {
+ if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED)
return CrPolicyIndicatorType.RECOMMENDED;
- if (enforcement == chrome.settingsPrivate.PolicyEnforcement.ENFORCED) {
- switch (source) {
- case chrome.settingsPrivate.PolicySource.PRIMARY_USER:
+ if (enforcement == chrome.settingsPrivate.Enforcement.ENFORCED) {
+ switch (controlledBy) {
+ case chrome.settingsPrivate.ControlledBy.PRIMARY_USER:
return CrPolicyIndicatorType.PRIMARY_USER;
- case chrome.settingsPrivate.PolicySource.OWNER:
+ case chrome.settingsPrivate.ControlledBy.OWNER:
return CrPolicyIndicatorType.OWNER;
- case chrome.settingsPrivate.PolicySource.USER_POLICY:
+ case chrome.settingsPrivate.ControlledBy.USER_POLICY:
return CrPolicyIndicatorType.USER_POLICY;
- case chrome.settingsPrivate.PolicySource.DEVICE_POLICY:
+ case chrome.settingsPrivate.ControlledBy.DEVICE_POLICY:
return CrPolicyIndicatorType.DEVICE_POLICY;
- case chrome.settingsPrivate.PolicySource.EXTENSION:
- return CrPolicyIndicatorType.EXTENSION;
}
}
return CrPolicyIndicatorType.NONE;

Powered by Google App Engine
This is Rietveld 408576698