| 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], | 12 behaviors: [CrPolicyIndicatorBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** | 15 iconAriaLabel: String, |
| 16 * Optional preference object associated with the indicator. Initialized to | |
| 17 * null so that computed functions will get called if this is never set. | |
| 18 * @type {!chrome.settingsPrivate.PrefObject|undefined} | |
| 19 */ | |
| 20 pref: Object, | |
| 21 | 16 |
| 22 /** | 17 /** |
| 23 * Which indicator type to show (or NONE). | 18 * Which indicator type to show (or NONE). |
| 24 * @type {CrPolicyIndicatorType} | 19 * @type {CrPolicyIndicatorType} |
| 25 * @override | 20 * @override |
| 26 */ | 21 */ |
| 27 indicatorType: { | 22 indicatorType: { |
| 28 type: String, | 23 type: String, |
| 29 value: CrPolicyIndicatorType.NONE, | 24 value: CrPolicyIndicatorType.NONE, |
| 30 computed: 'getIndicatorTypeForPref_(pref.controlledBy, pref.enforcement)', | 25 computed: 'getIndicatorTypeForPref_(pref.controlledBy, pref.enforcement)', |
| 31 }, | 26 }, |
| 32 | 27 |
| 33 /** @override */ | 28 /** @override */ |
| 34 indicatorTooltip: { | 29 indicatorTooltip: { |
| 35 type: String, | 30 type: String, |
| 36 computed: 'getIndicatorTooltipForPref_(indicatorType, pref.*)', | 31 computed: 'getIndicatorTooltipForPref_(indicatorType, pref.*)', |
| 37 }, | 32 }, |
| 33 |
| 34 /** |
| 35 * Optional preference object associated with the indicator. Initialized to |
| 36 * null so that computed functions will get called if this is never set. |
| 37 * @type {!chrome.settingsPrivate.PrefObject|undefined} |
| 38 */ |
| 39 pref: Object, |
| 38 }, | 40 }, |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * @param {!chrome.settingsPrivate.ControlledBy|undefined} controlledBy | 43 * @param {!chrome.settingsPrivate.ControlledBy|undefined} controlledBy |
| 42 * @param {!chrome.settingsPrivate.Enforcement|undefined} enforcement | 44 * @param {!chrome.settingsPrivate.Enforcement|undefined} enforcement |
| 43 * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy| | 45 * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy| |
| 44 * and |enforcement|. | 46 * and |enforcement|. |
| 45 */ | 47 */ |
| 46 getIndicatorTypeForPref_: function(controlledBy, enforcement) { | 48 getIndicatorTypeForPref_: function(controlledBy, enforcement) { |
| 47 if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED) | 49 if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 67 * @param {CrPolicyIndicatorType} indicatorType | 69 * @param {CrPolicyIndicatorType} indicatorType |
| 68 * @return {string} The tooltip text for |indicatorType|. | 70 * @return {string} The tooltip text for |indicatorType|. |
| 69 * @private | 71 * @private |
| 70 */ | 72 */ |
| 71 getIndicatorTooltipForPref_: function(indicatorType) { | 73 getIndicatorTooltipForPref_: function(indicatorType) { |
| 72 var matches = this.pref && this.pref.value == this.pref.recommendedValue; | 74 var matches = this.pref && this.pref.value == this.pref.recommendedValue; |
| 73 return this.getIndicatorTooltip( | 75 return this.getIndicatorTooltip( |
| 74 indicatorType, this.pref.controlledByName || '', matches); | 76 indicatorType, this.pref.controlledByName || '', matches); |
| 75 }, | 77 }, |
| 76 }); | 78 }); |
| OLD | NEW |