OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Polymer element for indicating policies that apply to an | 6 * @fileoverview Polymer element for indicating policies that apply to an |
7 * element controlling a settings preference. | 7 * element controlling a settings preference. |
8 */ | 8 */ |
9 Polymer({ | 9 Polymer({ |
10 is: 'cr-policy-pref-indicator', | 10 is: 'cr-policy-pref-indicator', |
11 | 11 |
12 behaviors: [CrPolicyIndicatorBehavior, CrPolicyPrefBehavior], | 12 behaviors: [CrPolicyIndicatorBehavior, CrPolicyPrefBehavior], |
13 | 13 |
14 properties: { | 14 properties: { |
15 /** | 15 /** |
16 * Optional preference object associated with the indicator. Initialized to | 16 * Optional preference object associated with the indicator. Initialized to |
17 * null so that computed functions will get called if this is never set. | 17 * null so that computed functions will get called if this is never set. |
18 * @type {!chrome.settingsPrivate.PrefObject|undefined} | 18 * @type {!chrome.settingsPrivate.PrefObject|undefined} |
19 */ | 19 */ |
20 pref: Object, | 20 pref: Object, |
21 | 21 |
22 /** | 22 /** |
23 * Which indicator type to show (or NONE). | 23 * Which indicator type to show (or NONE). |
24 * @type {CrPolicyIndicatorType} | 24 * @type {CrPolicyIndicatorType} |
michaelpg
2017/02/15 02:02:11
@private?
stevenjb
2017/02/15 02:23:29
Done.
| |
25 */ | 25 */ |
26 indicatorType: { | 26 indicatorType_: { |
27 type: String, | 27 type: String, |
28 value: CrPolicyIndicatorType.NONE, | 28 value: CrPolicyIndicatorType.NONE, |
29 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', | 29 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', |
30 }, | 30 }, |
31 }, | 31 }, |
32 | 32 |
33 /** | 33 /** |
34 * @param {CrPolicyIndicatorType} type | 34 * @param {CrPolicyIndicatorType} type |
35 * @param {!chrome.settingsPrivate.PrefObject} pref | |
36 * @return {string} The tooltip text for |type|. | 35 * @return {string} The tooltip text for |type|. |
37 * @private | 36 * @private |
38 */ | 37 */ |
39 getTooltip_: function(type, pref) { | 38 getTooltip_: function(type) { |
40 var matches = pref && pref.value == pref.recommendedValue; | 39 var matches = !!this.pref && this.pref.value == this.pref.recommendedValue; |
41 return this.getPolicyIndicatorTooltip( | 40 return this.getPolicyIndicatorTooltip( |
42 type, pref.controlledByName || '', matches); | 41 type, this.pref.controlledByName || '', matches); |
43 }, | 42 }, |
44 | 43 |
45 /** | 44 /** |
46 * @return {boolean} Whether the policy indicator is on. Useful for testing. | 45 * @return {boolean} Whether the policy indicator is on. Useful for testing. |
47 */ | 46 */ |
48 isActive: function() { | 47 isActive: function() { |
49 return this.isIndicatorVisible(this.indicatorType); | 48 return this.isIndicatorVisible(this.indicatorType_); |
50 }, | 49 }, |
51 }); | 50 }); |
OLD | NEW |