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..ad393b95b2e21fa3784d71ace175efbc4cc70a50 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() { |
|
dschuyler
2017/02/28 19:42:40
How about changing this to isPrefEnforced? That se
stevenjb
2017/02/28 20:04:37
I already suggested that we not include the extra
Dan Beam
2017/02/28 20:07:07
and i still disagree because the code is now wrong
michaelpg
2017/02/28 21:55:50
I added a TODO about the policy name. *this* funct
|
| + 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; |
| + hasPrefPolicyIndicator: function() { |
|
dschuyler
2017/02/28 19:42:40
How about hasPrefIndicator since RECOMMENDED isn't
stevenjb
2017/02/28 20:04:37
See previous comment.
michaelpg
2017/02/28 21:55:50
RECOMMENDED is a policy, just a non-enforced one.
stevenjb
2017/02/28 21:59:01
That's also a good point, you are correct about wh
|
| + return this.isPrefPolicyControlled() || |
| + this.pref.enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED; |
| }, |
| }; |