Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js

Issue 2624003003: WebUI: Add cr-policy-pref-indicator tests (Closed)
Patch Set: Fix closure Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 accessibility audit
michaelpg 2017/02/15 02:02:11 why does the accessibility audit care if the eleme
stevenjb 2017/02/15 02:23:29 Turns out we don't need this any more, so nevermin
56 break;
56 case CrPolicyIndicatorType.PRIMARY_USER: 57 case CrPolicyIndicatorType.PRIMARY_USER:
57 icon = 'cr:group'; 58 icon = 'cr:group';
58 break; 59 break;
59 case CrPolicyIndicatorType.OWNER: 60 case CrPolicyIndicatorType.OWNER:
60 icon = 'cr:person'; 61 icon = 'cr: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 = 'cr20:domain'; 66 icon = 'cr20:domain';
66 break; 67 break;
67 default: 68 default:
68 assertNotReached(); 69 assertNotReached();
70 icon = ''; // For closure
69 } 71 }
70 return icon; 72 return icon;
71 }, 73 },
72 74
73 /** 75 /**
74 * @param {CrPolicyIndicatorType} type 76 * @param {!CrPolicyIndicatorType} type
75 * @param {string} name The name associated with the indicator. See 77 * @param {string} name The name associated with the indicator. See
76 * chrome.settingsPrivate.PrefObject.controlledByName 78 * chrome.settingsPrivate.PrefObject.controlledByName
77 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator 79 * @param {boolean=} opt_matches For RECOMMENDED only, whether the indicator
78 * value matches the recommended value. 80 * value matches the recommended value.
79 * @return {string} The tooltip text for |type|. 81 * @return {string} The tooltip text for |type|.
80 */ 82 */
81 getPolicyIndicatorTooltip: function(type, name, opt_matches) { 83 getPolicyIndicatorTooltip: function(type, name, opt_matches) {
82 if (!CrPolicyStrings) 84 if (!CrPolicyStrings)
83 return ''; // Tooltips may not be defined, e.g. in OOBE. 85 return ''; // Tooltips may not be defined, e.g. in OOBE.
84 switch (type) { 86 switch (type) {
85 case CrPolicyIndicatorType.PRIMARY_USER: 87 case CrPolicyIndicatorType.PRIMARY_USER:
86 return CrPolicyStrings.controlledSettingShared.replace('$1', name); 88 return CrPolicyStrings.controlledSettingShared.replace('$1', name);
87 case CrPolicyIndicatorType.OWNER: 89 case CrPolicyIndicatorType.OWNER:
88 return CrPolicyStrings.controlledSettingOwner.replace('$1', name); 90 return CrPolicyStrings.controlledSettingOwner.replace('$1', name);
89 case CrPolicyIndicatorType.USER_POLICY: 91 case CrPolicyIndicatorType.USER_POLICY:
90 case CrPolicyIndicatorType.DEVICE_POLICY: 92 case CrPolicyIndicatorType.DEVICE_POLICY:
91 return CrPolicyStrings.controlledSettingPolicy; 93 return CrPolicyStrings.controlledSettingPolicy;
92 case CrPolicyIndicatorType.RECOMMENDED: 94 case CrPolicyIndicatorType.RECOMMENDED:
93 return opt_matches ? 95 return opt_matches ?
94 CrPolicyStrings.controlledSettingRecommendedMatches : 96 CrPolicyStrings.controlledSettingRecommendedMatches :
95 CrPolicyStrings.controlledSettingRecommendedDiffers; 97 CrPolicyStrings.controlledSettingRecommendedDiffers;
96 } 98 }
97 return ''; 99 return '';
98 }, 100 },
99 }; 101 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698