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

Unified Diff: ui/webui/resources/cr_elements/v1_0/policy/cr_policy_network_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_network_behavior.js
diff --git a/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_network_behavior.js b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_network_behavior.js
new file mode 100644
index 0000000000000000000000000000000000000000..fc9b097ba8dc9c90329666805a81a82ba2fa3a74
--- /dev/null
+++ b/ui/webui/resources/cr_elements/v1_0/policy/cr_policy_network_behavior.js
@@ -0,0 +1,46 @@
+// 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 network properties.
+ */
+
+/** @polymerBehavior */
+var CrPolicyNetworkBehavior = {
+ /**
+ * @param {!CrOnc.NetworkProperty|undefined} property
+ * @return {boolean} True if the network propety is controlled by a policy
+ * (either enforced or recommended).
+ */
+ isNetworkPolicyControlled: function(property) {
+ if (typeof property != 'object' || !property.Effective)
+ return false;
+ // Enforced
+ var effective = property.Effective;
+ if (effective == 'UserPolicy' || effective == 'DevicePolicy')
+ return true;
+ // Recommended
+ if (property.hasOwnProperty('UserPolicy') ||
+ property.hasOwnProperty('DevicePolicy')) {
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * @param {!CrOnc.NetworkProperty|undefined} property
+ * @return {boolean} True if the network propety is controlled by a policy.
+ */
+ isNetworkPolicyEnforced: function(property) {
+ if (!this.isNetworkPolicyControlled(property))
+ return false;
+ if (property.hasOwnProperty('UserEditable'))
+ return !property.UserEditable;
+ if (property.hasOwnProperty('DeviceEditable'))
+ return !property.DeviceEditable;
+ return true;
+ },
+
+
+};

Powered by Google App Engine
This is Rietveld 408576698