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

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

Issue 2555373006: MD Settings: cr-policy-pref-indicator: Eliminate controllingUser (Closed)
Patch Set: . Created 4 years 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
« no previous file with comments | « ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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, CrPolicyPrefBehavior], 12 behaviors: [CrPolicyIndicatorBehavior, CrPolicyPrefBehavior],
13 13
14 properties: { 14 properties: {
15 /** 15 /**
16 * Optional preference object associated with the indicator. Initialized to 16 * Optional preference object associated with the indicator. Initialized to
17 * null so that computed functions will get called if this is never set. 17 * null so that computed functions will get called if this is never set.
18 * @type {?chrome.settingsPrivate.PrefObject} 18 * @type {!chrome.settingsPrivate.PrefObject|undefined}
19 */ 19 */
20 pref: {type: Object, value: null}, 20 pref: Object,
21
22 /**
23 * Optional email of the user controlling the setting when the setting does
24 * not correspond to a pref (Chrome OS only). Only used when pref is null.
25 * Initialized to '' so that computed functions will get called if this is
26 * never set. TODO(stevenjb/michaelpg): Create a separate indicator for
27 * non-pref (i.e. explicitly set) indicators (see language_detail_page).
28 */
29 controllingUser: {type: String, value: ''},
30 21
31 /** 22 /**
32 * Which indicator type to show (or NONE). 23 * Which indicator type to show (or NONE).
33 * @type {CrPolicyIndicatorType} 24 * @type {CrPolicyIndicatorType}
34 */ 25 */
35 indicatorType: { 26 indicatorType: {
36 type: String, 27 type: String,
37 value: CrPolicyIndicatorType.NONE, 28 value: CrPolicyIndicatorType.NONE,
38 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)', 29 computed: 'getIndicatorType(pref.controlledBy, pref.enforcement)',
39 }, 30 },
40 }, 31 },
41 32
42 /** 33 /**
43 * @param {CrPolicyIndicatorType} type 34 * @param {CrPolicyIndicatorType} type
44 * @param {?chrome.settingsPrivate.PrefObject} pref 35 * @param {!chrome.settingsPrivate.PrefObject} pref
45 * @return {string} The tooltip text for |type|. 36 * @return {string} The tooltip text for |type|.
46 * @private 37 * @private
47 */ 38 */
48 getTooltip_: function(type, pref, controllingUser) { 39 getTooltip_: function(type, pref) {
49 if (type == CrPolicyIndicatorType.RECOMMENDED) { 40 if (type == CrPolicyIndicatorType.RECOMMENDED) {
50 if (pref && pref.value == pref.recommendedValue) 41 if (pref && pref.value == pref.recommendedValue)
51 return this.i18n_('controlledSettingRecommendedMatches'); 42 return this.i18n_('controlledSettingRecommendedMatches');
52 return this.i18n_('controlledSettingRecommendedDiffers'); 43 return this.i18n_('controlledSettingRecommendedDiffers');
53 } 44 }
54 var name = pref ? pref.controlledByName : controllingUser; 45 return this.getPolicyIndicatorTooltip(type, pref.controlledByName || '');
55 return this.getPolicyIndicatorTooltip(type, name);
56 } 46 }
57 }); 47 });
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698