Index: ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js |
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js b/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js |
index dcb58c425f3253a9db5dc88c38f1dc26607f2ced..90466143c0c38c4c3585b66140ed24322ad7c11a 100644 |
--- a/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js |
+++ b/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js |
@@ -15,30 +15,43 @@ Polymer({ |
/** |
* Optional preference object associated with the indicator. Initialized to |
* null so that computed functions will get called if this is never set. |
- * @type {!chrome.settingsPrivate.PrefObject|undefined} |
+ * @type {?chrome.settingsPrivate.PrefObject} |
*/ |
- pref: Object, |
+ pref: { |
+ type: Object, |
+ value: null, |
+ }, |
/** |
- * Which indicator type to show (or NONE). |
+ * Which indicator type to show (or NONE). This may be set explicitly, or |
+ * computed if |pref| is set. |
* @type {CrPolicyIndicatorType} |
*/ |
indicatorType: { |
type: String, |
value: CrPolicyIndicatorType.NONE, |
- computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', |
}, |
}, |
+ observers: ['prefChanged_(pref.*)'], |
+ |
+ /** @private */ |
+ prefChanged_() { |
Dan Beam
2017/01/18 01:06:34
prefChanged_: function
stevenjb
2017/01/18 23:13:03
Sigh. Sorry. Done.
|
+ if (!this.pref) |
+ return; |
+ this.indicatorType = |
+ this.getIndicatorType(this.pref.controlledBy, this.pref.enforcement); |
+ }, |
+ |
/** |
* @param {CrPolicyIndicatorType} type |
- * @param {!chrome.settingsPrivate.PrefObject} pref |
* @return {string} The tooltip text for |type|. |
* @private |
*/ |
- getTooltip_: function(type, pref) { |
- var matches = pref && pref.value == pref.recommendedValue; |
+ getTooltip_: function(type) { |
+ var pref = this.pref; |
+ var matches = !!pref && pref.value == pref.recommendedValue; |
return this.getPolicyIndicatorTooltip( |
- type, pref.controlledByName || '', matches); |
+ type, (pref && pref.controlledByName) || '', matches); |
} |
}); |