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

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

Issue 1342033002: Add tooltips to cr-policy-indicator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_521791_settings_policy_1
Patch Set: Feedback 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 486ff722035f4ef74d710a5acf7654fa4e94ca5d..d81c3aae380dae7d0f0ff7446c85ccb99768f13b 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
@@ -3,10 +3,12 @@
// found in the LICENSE file.
/**
- * @fileoverview
- * @element cr-policy-indicator
+ * @fileoverview Polymer element for indicating policies that apply to an
+ * element controlling a settings preference.
*/
+(function() {
+
/** @enum {string} */
var IndicatorType = {
DEVICE_POLICY: 'devicePolicy',
@@ -18,6 +20,7 @@ var IndicatorType = {
USER_POLICY: 'userPolicy',
};
+/** @element cr-policy-indicator */
Polymer({
is: 'cr-policy-indicator',
@@ -35,9 +38,7 @@ Polymer({
indicatorType: {type: String, value: IndicatorType.NONE},
},
- observers: [
- 'prefPolicyChanged_(pref.policySource, pref.policyEnforcement)'
- ],
+ observers: ['prefPolicyChanged_(pref.policySource, pref.policyEnforcement)'],
/**
* Polymer observer for pref.
@@ -94,6 +95,41 @@ Polymer({
return 'social:domain';
}
assertNotReached();
+ },
+
+ /**
+ * @param {string} id The id of the string to translate.
+ * @param {string=} opt_name An optional name argument.
+ * @return The translated string.
+ */
+ i18n_: function (id, opt_name) {
+ return loadTimeData.getStringF(id, opt_name);
+ },
+
+ /**
+ * @param {IndicatorType} type The type of indicator.
+ * @param {!chrome.settingsPrivate.PrefObject} pref
+ * @return {string} The tooltip text for |type|.
+ * @private
+ */
+ getTooltipText_: function(type, pref) {
+ var name = pref.policySourceName || '';
+ switch (type) {
+ case IndicatorType.PRIMARY_USER:
+ return this.i18n_('controlledSettingShared', name);
+ case IndicatorType.OWNER:
+ return this.i18n_('controlledSettingOwner', name);
+ case IndicatorType.USER_POLICY:
+ case IndicatorType.DEVICE_POLICY:
+ return this.i18n_('controlledSettingPolicy');
+ case IndicatorType.EXTENSION:
+ return this.i18n_('controlledSettingExtension', name);
+ case IndicatorType.RECOMMENDED:
+ if (pref.value == pref.recommendedValue)
+ return this.i18n_('controlledSettingRecommendedMatches');
+ return this.i18n_('controlledSettingRecommendedDiffers');
+ }
return '';
}
});
+})();
« 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