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

Unified Diff: ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js

Issue 1367413002: Add user field to cr-policy-indicator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (fix rebase) Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js
diff --git a/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js
index 96e5a94da9c1d09aa7cb289904fc398c4cdad689..d9248c52fabf4d7b0720e72e3481d9ed3b3567f4 100644
--- a/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js
+++ b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.js
@@ -28,10 +28,19 @@ Polymer({
properties: {
/**
- * The preference object to show an indicator for.
- * @type {chrome.settingsPrivate.PrefObject|undefined}
+ * Optional preference object associated with the indicator. Initialized to
+ * null so that computed functions will get called if this is never set.
+ * @type {?chrome.settingsPrivate.PrefObject}
*/
- pref: {type: Object},
+ pref: {type: Object, value: null},
+
+ /**
+ * Optional email of the user controlling the setting when the setting does
+ * not correspond to a pref (Chrome OS only). Only used when pref is null.
+ * Initialized to '' so that computed functions will get called if this is
+ * never set.
+ */
+ controllingUser: {type: String, value: ''},
/**
* Which indicator type to show (or NONE).
@@ -113,11 +122,13 @@ Polymer({
/**
* @param {CrPolicyIndicator.Type} type The type of indicator.
* @param {?chrome.settingsPrivate.PrefObject} pref
+ * @param {string} controllingUser The user controlling the setting, if |pref|
+ * is null.
* @return {string} The tooltip text for |type|.
* @private
*/
- getTooltipText_: function(type, pref) {
- var name = pref.policySourceName || '';
+ getTooltipText_: function(type, pref, controllingUser) {
+ var name = pref ? pref.policySourceName : controllingUser;
switch (type) {
case CrPolicyIndicator.Type.PRIMARY_USER:
@@ -130,7 +141,7 @@ Polymer({
case CrPolicyIndicator.Type.EXTENSION:
return this.i18n_('controlledSettingExtension', name);
case CrPolicyIndicator.Type.RECOMMENDED:
- if (pref.value == pref.recommendedValue)
+ if (pref && pref.value == pref.recommendedValue)
return this.i18n_('controlledSettingRecommendedMatches');
return this.i18n_('controlledSettingRecommendedDiffers');
}
« no previous file with comments | « ui/webui/resources/cr_elements/v1_0/policy/cr_policy_indicator.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698