Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | |
|
michaelpg
2016/12/09 03:23:10
revert blank line
stevenjb
2016/12/09 16:51:47
Done.
| |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 | 5 |
| 5 /** | 6 /** |
| 6 * @fileoverview Polymer element for indicating policies that apply to an | 7 * @fileoverview Polymer element for indicating policies that apply to an |
| 7 * element controlling a settings preference. | 8 * element controlling a settings preference. |
| 8 */ | 9 */ |
| 9 Polymer({ | 10 Polymer({ |
| 10 is: 'cr-policy-pref-indicator', | 11 is: 'cr-policy-pref-indicator', |
| 11 | 12 |
| 12 behaviors: [CrPolicyIndicatorBehavior, CrPolicyPrefBehavior], | 13 behaviors: [CrPolicyIndicatorBehavior, CrPolicyPrefBehavior], |
| 13 | 14 |
| 14 properties: { | 15 properties: { |
| 15 /** | 16 /** |
| 16 * Optional preference object associated with the indicator. Initialized to | 17 * Optional preference object associated with the indicator. Initialized to |
| 17 * null so that computed functions will get called if this is never set. | 18 * null so that computed functions will get called if this is never set. |
| 18 * @type {?chrome.settingsPrivate.PrefObject} | 19 * @type {!chrome.settingsPrivate.PrefObject|undefined} |
| 19 */ | 20 */ |
| 20 pref: {type: Object, value: null}, | 21 pref: Object, |
| 21 | |
| 22 /** | |
| 23 * Optional email of the user controlling the setting when the setting does | |
| 24 * not correspond to a pref (Chrome OS only). Only used when pref is null. | |
| 25 * Initialized to '' so that computed functions will get called if this is | |
| 26 * never set. TODO(stevenjb/michaelpg): Create a separate indicator for | |
| 27 * non-pref (i.e. explicitly set) indicators (see language_detail_page). | |
| 28 */ | |
| 29 controllingUser: {type: String, value: ''}, | |
| 30 | 22 |
| 31 /** | 23 /** |
| 32 * Which indicator type to show (or NONE). | 24 * Which indicator type to show (or NONE). |
| 33 * @type {CrPolicyIndicatorType} | 25 * @type {CrPolicyIndicatorType} |
| 34 */ | 26 */ |
| 35 indicatorType: { | 27 indicatorType: { |
| 36 type: String, | 28 type: String, |
| 37 value: CrPolicyIndicatorType.NONE, | 29 value: CrPolicyIndicatorType.NONE, |
| 38 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', | 30 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', |
| 39 }, | 31 }, |
| 40 }, | 32 }, |
| 41 | 33 |
| 42 /** | 34 /** |
| 43 * @param {CrPolicyIndicatorType} type | 35 * @param {CrPolicyIndicatorType} type |
| 44 * @param {?chrome.settingsPrivate.PrefObject} pref | 36 * @param {!chrome.settingsPrivate.PrefObject} pref |
| 45 * @return {string} The tooltip text for |type|. | 37 * @return {string} The tooltip text for |type|. |
| 46 * @private | 38 * @private |
| 47 */ | 39 */ |
| 48 getTooltip_: function(type, pref, controllingUser) { | 40 getTooltip_: function(type, pref) { |
| 49 if (type == CrPolicyIndicatorType.RECOMMENDED) { | 41 if (type == CrPolicyIndicatorType.RECOMMENDED) { |
| 50 if (pref && pref.value == pref.recommendedValue) | 42 if (pref && pref.value == pref.recommendedValue) |
| 51 return this.i18n_('controlledSettingRecommendedMatches'); | 43 return this.i18n_('controlledSettingRecommendedMatches'); |
| 52 return this.i18n_('controlledSettingRecommendedDiffers'); | 44 return this.i18n_('controlledSettingRecommendedDiffers'); |
| 53 } | 45 } |
| 54 var name = pref ? pref.controlledByName : controllingUser; | 46 return this.getPolicyIndicatorTooltip(type, pref.controlledByName || ''); |
| 55 return this.getPolicyIndicatorTooltip(type, name); | |
| 56 } | 47 } |
| 57 }); | 48 }); |
| OLD | NEW |