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

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

Issue 1391433003: Extract policy indicator behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_521791_network_indicators_a
Patch Set: . Created 5 years, 2 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
Index: ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js
diff --git a/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js
index 6aa3d39853077b535c00b2b2eb56030cc5bab78d..182827d212a4e65300013520003f3c75da369b22 100644
--- a/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js
+++ b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js
@@ -16,4 +16,29 @@ var CrPolicyPrefBehavior = {
return pref.policyEnforcement ==
chrome.settingsPrivate.PolicyEnforcement.ENFORCED;
},
+
+ /**
+ * @param {chrome.settingsPrivate.PolicySource} source
+ * @param {chrome.settingsPrivate.PolicyEnforcement} enforcement
+ * @return {CrPolicyIndicatorType} The indicator type based on |source| and
+ * |enforcement|.
+ */
+ getIndicatorType: function(source, enforcement) {
+ if (enforcement == chrome.settingsPrivate.PolicyEnforcement.ENFORCED) {
+ if (source == chrome.settingsPrivate.PolicySource.PRIMARY_USER)
+ return CrPolicyIndicatorType.PRIMARY_USER;
+ else if (source == chrome.settingsPrivate.PolicySource.OWNER)
+ return CrPolicyIndicatorType.OWNER;
+ else if (source == chrome.settingsPrivate.PolicySource.USER_POLICY)
+ return CrPolicyIndicatorType.USER_POLICY;
+ else if (source == chrome.settingsPrivate.PolicySource.DEVICE_POLICY)
+ return CrPolicyIndicatorType.DEVICE_POLICY;
+ else if (source == chrome.settingsPrivate.PolicySource.EXTENSION)
+ return CrPolicyIndicatorType.EXTENSION;
Dan Beam 2015/10/15 04:31:01 nit: use switches, no elses after returns
stevenjb 2015/10/15 22:56:22 Done.
+ } else if (enforcement ==
+ chrome.settingsPrivate.PolicyEnforcement.RECOMMENDED) {
+ return CrPolicyIndicatorType.RECOMMENDED;
+ }
+ return CrPolicyIndicatorType.NONE;
+ },
};

Powered by Google App Engine
This is Rietveld 408576698