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 * TODO(michaelpg): Since extensions can also control settings and be indicated, | 7 * TODO(michaelpg): Since extensions can also control settings and be indicated, |
8 * rework the "policy" naming scheme throughout this directory. | 8 * rework the "policy" naming scheme throughout this directory. |
9 */ | 9 */ |
10 | 10 |
11 /** | 11 /** |
12 * Strings required for policy indicators. These must be set at runtime. | 12 * Strings required for policy indicators. These must be set at runtime. |
13 * Chrome OS only strings may be undefined. | 13 * Chrome OS only strings may be undefined. |
14 * @type {{ | 14 * @type {{ |
| 15 * controlledSettingExtension: string, |
15 * controlledSettingPolicy: string, | 16 * controlledSettingPolicy: string, |
16 * controlledSettingRecommendedMatches: string, | 17 * controlledSettingRecommendedMatches: string, |
17 * controlledSettingRecommendedDiffers: string, | 18 * controlledSettingRecommendedDiffers: string, |
18 * controlledSettingShared: (string|undefined), | 19 * controlledSettingShared: (string|undefined), |
19 * controlledSettingOwner: (string|undefined), | 20 * controlledSettingOwner: (string|undefined), |
20 * }} | 21 * }} |
21 */ | 22 */ |
22 var CrPolicyStrings; | 23 var CrPolicyStrings; |
23 | 24 |
24 /** @enum {string} */ | 25 /** @enum {string} */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 computed: 'getIndicatorTooltip(indicatorType, indicatorSourceName)', | 73 computed: 'getIndicatorTooltip(indicatorType, indicatorSourceName)', |
73 }, | 74 }, |
74 }, | 75 }, |
75 | 76 |
76 /** | 77 /** |
77 * @param {CrPolicyIndicatorType} type | 78 * @param {CrPolicyIndicatorType} type |
78 * @return {boolean} True if the indicator should be shown. | 79 * @return {boolean} True if the indicator should be shown. |
79 * @private | 80 * @private |
80 */ | 81 */ |
81 getIndicatorVisible_: function(type) { | 82 getIndicatorVisible_: function(type) { |
82 return type != CrPolicyIndicatorType.NONE && | 83 return type != CrPolicyIndicatorType.NONE; |
83 type != CrPolicyIndicatorType.EXTENSION; | |
84 }, | 84 }, |
85 | 85 |
86 /** | 86 /** |
87 * @param {CrPolicyIndicatorType} type | 87 * @param {CrPolicyIndicatorType} type |
88 * @return {string} The iron-icon icon name. | 88 * @return {string} The iron-icon icon name. |
89 * @private | 89 * @private |
90 */ | 90 */ |
91 getIndicatorIcon_: function(type) { | 91 getIndicatorIcon_: function(type) { |
92 var icon = ''; | |
93 switch (type) { | 92 switch (type) { |
94 case CrPolicyIndicatorType.EXTENSION: | 93 case CrPolicyIndicatorType.EXTENSION: |
| 94 return 'cr:extension'; |
95 case CrPolicyIndicatorType.NONE: | 95 case CrPolicyIndicatorType.NONE: |
96 return icon; | 96 return ''; |
97 case CrPolicyIndicatorType.PRIMARY_USER: | 97 case CrPolicyIndicatorType.PRIMARY_USER: |
98 icon = 'cr:group'; | 98 return 'cr:group'; |
99 break; | |
100 case CrPolicyIndicatorType.OWNER: | 99 case CrPolicyIndicatorType.OWNER: |
101 icon = 'cr:person'; | 100 return 'cr:person'; |
102 break; | |
103 case CrPolicyIndicatorType.USER_POLICY: | 101 case CrPolicyIndicatorType.USER_POLICY: |
104 case CrPolicyIndicatorType.DEVICE_POLICY: | 102 case CrPolicyIndicatorType.DEVICE_POLICY: |
105 case CrPolicyIndicatorType.RECOMMENDED: | 103 case CrPolicyIndicatorType.RECOMMENDED: |
106 icon = 'cr20:domain'; | 104 return 'cr20:domain'; |
107 break; | |
108 default: | 105 default: |
109 assertNotReached(); | 106 assertNotReached(); |
110 } | 107 } |
111 return icon; | |
112 }, | 108 }, |
113 | 109 |
114 /** | 110 /** |
115 * @param {!CrPolicyIndicatorType} type | 111 * @param {!CrPolicyIndicatorType} type |
116 * @param {string} name The name associated with the indicator. See | 112 * @param {string} name The name associated with the indicator. See |
117 * chrome.settingsPrivate.PrefObject.controlledByName | 113 * chrome.settingsPrivate.PrefObject.controlledByName |
118 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator | 114 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator |
119 * value matches the recommended value. | 115 * value matches the recommended value. |
120 * @return {string} The tooltip text for |type|. | 116 * @return {string} The tooltip text for |type|. |
121 */ | 117 */ |
122 getIndicatorTooltip: function(type, name, opt_matches) { | 118 getIndicatorTooltip: function(type, name, opt_matches) { |
123 if (!CrPolicyStrings) | 119 if (!CrPolicyStrings) |
124 return ''; // Tooltips may not be defined, e.g. in OOBE. | 120 return ''; // Tooltips may not be defined, e.g. in OOBE. |
125 switch (type) { | 121 switch (type) { |
| 122 case CrPolicyIndicatorType.EXTENSION: |
| 123 return CrPolicyStrings.controlledSettingExtension; |
126 case CrPolicyIndicatorType.PRIMARY_USER: | 124 case CrPolicyIndicatorType.PRIMARY_USER: |
127 return CrPolicyStrings.controlledSettingShared.replace('$1', name); | 125 return CrPolicyStrings.controlledSettingShared.replace('$1', name); |
128 case CrPolicyIndicatorType.OWNER: | 126 case CrPolicyIndicatorType.OWNER: |
129 return CrPolicyStrings.controlledSettingOwner.replace('$1', name); | 127 return CrPolicyStrings.controlledSettingOwner.replace('$1', name); |
130 case CrPolicyIndicatorType.USER_POLICY: | 128 case CrPolicyIndicatorType.USER_POLICY: |
131 case CrPolicyIndicatorType.DEVICE_POLICY: | 129 case CrPolicyIndicatorType.DEVICE_POLICY: |
132 return CrPolicyStrings.controlledSettingPolicy; | 130 return CrPolicyStrings.controlledSettingPolicy; |
133 case CrPolicyIndicatorType.RECOMMENDED: | 131 case CrPolicyIndicatorType.RECOMMENDED: |
134 return opt_matches ? | 132 return opt_matches ? |
135 CrPolicyStrings.controlledSettingRecommendedMatches : | 133 CrPolicyStrings.controlledSettingRecommendedMatches : |
136 CrPolicyStrings.controlledSettingRecommendedDiffers; | 134 CrPolicyStrings.controlledSettingRecommendedDiffers; |
137 } | 135 } |
138 return ''; | 136 return ''; |
139 }, | 137 }, |
140 }; | 138 }; |
OLD | NEW |