Chromium Code Reviews| 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 Behavior for policy controlled indicators. | 6 * @fileoverview Behavior for policy controlled indicators. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Strings required for policy indicators. These must be set at runtime. | 10 * Strings required for policy indicators. These must be set at runtime. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 return type != CrPolicyIndicatorType.NONE && | 41 return type != CrPolicyIndicatorType.NONE && |
| 42 type != CrPolicyIndicatorType.EXTENSION; | 42 type != CrPolicyIndicatorType.EXTENSION; |
| 43 }, | 43 }, |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @param {CrPolicyIndicatorType} type | 46 * @param {CrPolicyIndicatorType} type |
| 47 * @return {string} The iron-icon icon name. | 47 * @return {string} The iron-icon icon name. |
| 48 * @private | 48 * @private |
| 49 */ | 49 */ |
| 50 getPolicyIndicatorIcon: function(type) { | 50 getPolicyIndicatorIcon: function(type) { |
| 51 var icon = ''; | 51 var icon; |
| 52 switch (type) { | 52 switch (type) { |
| 53 case CrPolicyIndicatorType.EXTENSION: | 53 case CrPolicyIndicatorType.EXTENSION: |
| 54 case CrPolicyIndicatorType.NONE: | 54 case CrPolicyIndicatorType.NONE: |
| 55 return icon; | 55 icon = 'domain'; // Set a valid icon for accessability audit |
|
Dan Beam
2017/01/18 01:06:34
accessibility *
stevenjb
2017/01/18 23:13:03
Done.
| |
| 56 break; | |
| 56 case CrPolicyIndicatorType.PRIMARY_USER: | 57 case CrPolicyIndicatorType.PRIMARY_USER: |
| 57 icon = 'group'; | 58 icon = 'group'; |
| 58 break; | 59 break; |
| 59 case CrPolicyIndicatorType.OWNER: | 60 case CrPolicyIndicatorType.OWNER: |
| 60 icon = 'person'; | 61 icon = 'person'; |
| 61 break; | 62 break; |
| 62 case CrPolicyIndicatorType.USER_POLICY: | 63 case CrPolicyIndicatorType.USER_POLICY: |
| 63 case CrPolicyIndicatorType.DEVICE_POLICY: | 64 case CrPolicyIndicatorType.DEVICE_POLICY: |
| 64 case CrPolicyIndicatorType.RECOMMENDED: | 65 case CrPolicyIndicatorType.RECOMMENDED: |
| 65 icon = 'domain'; | 66 icon = 'domain'; |
| 66 break; | 67 break; |
| 67 default: | 68 default: |
| 68 assertNotReached(); | 69 assertNotReached(); |
| 69 } | 70 } |
| 70 return 'cr:' + icon; | 71 return 'cr:' + icon; |
| 71 }, | 72 }, |
| 72 | 73 |
| 73 /** | 74 /** |
| 74 * @param {CrPolicyIndicatorType} type | 75 * @param {!CrPolicyIndicatorType} type |
| 75 * @param {string} name The name associated with the indicator. See | 76 * @param {string} name The name associated with the indicator. See |
| 76 * chrome.settingsPrivate.PrefObject.controlledByName | 77 * chrome.settingsPrivate.PrefObject.controlledByName |
| 77 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator | 78 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator |
| 78 * value matches the recommended value. | 79 * value matches the recommended value. |
| 79 * @return {string} The tooltip text for |type|. | 80 * @return {string} The tooltip text for |type|. |
| 80 */ | 81 */ |
| 81 getPolicyIndicatorTooltip: function(type, name, opt_matches) { | 82 getPolicyIndicatorTooltip: function(type, name, opt_matches) { |
| 82 if (!CrPolicyStrings) | 83 if (!CrPolicyStrings) |
| 83 return ''; // Tooltips may not be defined, e.g. in OOBE. | 84 return ''; // Tooltips may not be defined, e.g. in OOBE. |
| 84 switch (type) { | 85 switch (type) { |
| 85 case CrPolicyIndicatorType.PRIMARY_USER: | 86 case CrPolicyIndicatorType.PRIMARY_USER: |
| 86 return CrPolicyStrings.controlledSettingShared.replace('$1', name); | 87 return CrPolicyStrings.controlledSettingShared.replace('$1', name); |
| 87 case CrPolicyIndicatorType.OWNER: | 88 case CrPolicyIndicatorType.OWNER: |
| 88 return CrPolicyStrings.controlledSettingOwner.replace('$1', name); | 89 return CrPolicyStrings.controlledSettingOwner.replace('$1', name); |
| 89 case CrPolicyIndicatorType.USER_POLICY: | 90 case CrPolicyIndicatorType.USER_POLICY: |
| 90 case CrPolicyIndicatorType.DEVICE_POLICY: | 91 case CrPolicyIndicatorType.DEVICE_POLICY: |
| 91 return CrPolicyStrings.controlledSettingPolicy; | 92 return CrPolicyStrings.controlledSettingPolicy; |
| 92 case CrPolicyIndicatorType.RECOMMENDED: | 93 case CrPolicyIndicatorType.RECOMMENDED: |
| 93 return opt_matches ? | 94 return opt_matches ? |
| 94 CrPolicyStrings.controlledSettingRecommendedMatches : | 95 CrPolicyStrings.controlledSettingRecommendedMatches : |
| 95 CrPolicyStrings.controlledSettingRecommendedDiffers; | 96 CrPolicyStrings.controlledSettingRecommendedDiffers; |
| 96 } | 97 } |
| 97 return ''; | 98 return ''; |
| 98 }, | 99 }, |
| 99 }; | 100 }; |
| OLD | NEW |