Chromium Code Reviews| 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 0fd367c6238f3417266d038abf570cd81053fef5..db69dca9dc7cecb87f3170e73897e8f3c0989ed7 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 |
| @@ -9,35 +9,20 @@ |
| /** @polymerBehavior */ |
| var CrPolicyPrefBehavior = { |
| /** |
| - * @param {!chrome.settingsPrivate.PrefObject} pref |
| - * @return {boolean} True if the pref is controlled by an enforced policy. |
| + * @return {boolean} True if |this.pref| is controlled by an enforced policy. |
| */ |
| - isPrefPolicyControlled: function(pref) { |
| - return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED && |
| - pref.controlledBy != chrome.settingsPrivate.ControlledBy.EXTENSION; |
| + isPrefPolicyControlled: function() { |
| + return ( |
| + this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED && |
| + this.pref.controlledBy != |
| + chrome.settingsPrivate.ControlledBy.EXTENSION); |
| }, |
| /** |
| - * @param {!chrome.settingsPrivate.ControlledBy|undefined} controlledBy |
| - * @param {!chrome.settingsPrivate.Enforcement|undefined} enforcement |
| - * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy| |
| - * and |enforcement|. |
| + * @return {boolean} True if |this.pref| has a recommended or enforced policy. |
| */ |
| - getIndicatorType: function(controlledBy, enforcement) { |
| - if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED) |
| - return CrPolicyIndicatorType.RECOMMENDED; |
| - if (enforcement == chrome.settingsPrivate.Enforcement.ENFORCED) { |
| - switch (controlledBy) { |
| - case chrome.settingsPrivate.ControlledBy.PRIMARY_USER: |
| - return CrPolicyIndicatorType.PRIMARY_USER; |
| - case chrome.settingsPrivate.ControlledBy.OWNER: |
| - return CrPolicyIndicatorType.OWNER; |
| - case chrome.settingsPrivate.ControlledBy.USER_POLICY: |
| - return CrPolicyIndicatorType.USER_POLICY; |
| - case chrome.settingsPrivate.ControlledBy.DEVICE_POLICY: |
| - return CrPolicyIndicatorType.DEVICE_POLICY; |
| - } |
| - } |
| - return CrPolicyIndicatorType.NONE; |
| + hasPolicy: function() { |
|
stevenjb
2017/02/23 18:21:39
This is why I was confused with the controlled-but
michaelpg
2017/02/28 01:16:29
Done (only used by controlled-button to show the i
|
| + return this.isPrefPolicyControlled() || |
| + this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED; |
| }, |
| }; |