| 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', |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 * @param {!chrome.settingsPrivate.ControlledBy|undefined} controlledBy | 41 * @param {!chrome.settingsPrivate.ControlledBy|undefined} controlledBy |
| 42 * @param {!chrome.settingsPrivate.Enforcement|undefined} enforcement | 42 * @param {!chrome.settingsPrivate.Enforcement|undefined} enforcement |
| 43 * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy| | 43 * @return {CrPolicyIndicatorType} The indicator type based on |controlledBy| |
| 44 * and |enforcement|. | 44 * and |enforcement|. |
| 45 */ | 45 */ |
| 46 getIndicatorTypeForPref_: function(controlledBy, enforcement) { | 46 getIndicatorTypeForPref_: function(controlledBy, enforcement) { |
| 47 if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED) | 47 if (enforcement == chrome.settingsPrivate.Enforcement.RECOMMENDED) |
| 48 return CrPolicyIndicatorType.RECOMMENDED; | 48 return CrPolicyIndicatorType.RECOMMENDED; |
| 49 if (enforcement == chrome.settingsPrivate.Enforcement.ENFORCED) { | 49 if (enforcement == chrome.settingsPrivate.Enforcement.ENFORCED) { |
| 50 switch (controlledBy) { | 50 switch (controlledBy) { |
| 51 case chrome.settingsPrivate.ControlledBy.EXTENSION: |
| 52 return CrPolicyIndicatorType.EXTENSION; |
| 51 case chrome.settingsPrivate.ControlledBy.PRIMARY_USER: | 53 case chrome.settingsPrivate.ControlledBy.PRIMARY_USER: |
| 52 return CrPolicyIndicatorType.PRIMARY_USER; | 54 return CrPolicyIndicatorType.PRIMARY_USER; |
| 53 case chrome.settingsPrivate.ControlledBy.OWNER: | 55 case chrome.settingsPrivate.ControlledBy.OWNER: |
| 54 return CrPolicyIndicatorType.OWNER; | 56 return CrPolicyIndicatorType.OWNER; |
| 55 case chrome.settingsPrivate.ControlledBy.USER_POLICY: | 57 case chrome.settingsPrivate.ControlledBy.USER_POLICY: |
| 56 return CrPolicyIndicatorType.USER_POLICY; | 58 return CrPolicyIndicatorType.USER_POLICY; |
| 57 case chrome.settingsPrivate.ControlledBy.DEVICE_POLICY: | 59 case chrome.settingsPrivate.ControlledBy.DEVICE_POLICY: |
| 58 return CrPolicyIndicatorType.DEVICE_POLICY; | 60 return CrPolicyIndicatorType.DEVICE_POLICY; |
| 59 } | 61 } |
| 60 } | 62 } |
| 61 return CrPolicyIndicatorType.NONE; | 63 return CrPolicyIndicatorType.NONE; |
| 62 }, | 64 }, |
| 63 | 65 |
| 64 /** | 66 /** |
| 65 * @param {CrPolicyIndicatorType} indicatorType | 67 * @param {CrPolicyIndicatorType} indicatorType |
| 66 * @return {string} The tooltip text for |indicatorType|. | 68 * @return {string} The tooltip text for |indicatorType|. |
| 67 * @private | 69 * @private |
| 68 */ | 70 */ |
| 69 getIndicatorTooltipForPref_: function(indicatorType) { | 71 getIndicatorTooltipForPref_: function(indicatorType) { |
| 70 var matches = this.pref && this.pref.value == this.pref.recommendedValue; | 72 var matches = this.pref && this.pref.value == this.pref.recommendedValue; |
| 71 return this.getIndicatorTooltip( | 73 return this.getIndicatorTooltip( |
| 72 indicatorType, this.pref.controlledByName || '', matches); | 74 indicatorType, this.pref.controlledByName || '', matches); |
| 73 }, | 75 }, |
| 74 }); | 76 }); |
| OLD | NEW |