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

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

Issue 1369403006: Add cr-policy-network-indicator and add to internet settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate policy indicator strings 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
new file mode 100644
index 0000000000000000000000000000000000000000..9aa81e74a0e54fbe098a0816a0fa9b672e28f993
--- /dev/null
+++ b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_pref_behavior.js
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Behavior for policy controlled settings prefs.
+ */
+
+/** @polymerBehavior */
+var CrPolicyPrefBehavior = {
+ /**
+ * @param {!chrome.settingsPrivate.PrefObject} pref
+ * @return {boolean} True if the pref is controlled by an enforced policy.
+ */
+ isPrefPolicyControlled: function(pref) {
+ 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;
+ } else if (enforcement ==
+ chrome.settingsPrivate.PolicyEnforcement.RECOMMENDED) {
+ return CrPolicyIndicatorType.RECOMMENDED;
+ }
+ return CrPolicyIndicatorType.NONE;
+ },
+};

Powered by Google App Engine
This is Rietveld 408576698