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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Behavior for policy controlled network properties.
7 */
8
9 /** @polymerBehavior */
10 var CrPolicyNetworkBehavior = {
11 /**
12 * @param {!CrOnc.NetworkProperty|undefined} property
13 * @return {boolean} True if the network propety is controlled by a policy
14 * (either enforced or recommended).
15 */
16 isNetworkPolicyControlled: function(property) {
17 if (typeof property != 'object' || !property.Effective)
18 return false;
19 // Enforced
20 var effective = property.Effective;
21 if (effective == 'UserPolicy' || effective == 'DevicePolicy')
22 return true;
23 // Recommended
24 if (property.hasOwnProperty('UserPolicy') ||
25 property.hasOwnProperty('DevicePolicy')) {
26 return true;
27 }
28 return false;
29 },
30
31 /**
32 * @param {!CrOnc.NetworkProperty|undefined} property
33 * @return {boolean} True if the network propety is controlled by a policy.
34 */
35 isNetworkPolicyEnforced: function(property) {
36 if (!this.isNetworkPolicyControlled(property))
37 return false;
38 if (property.hasOwnProperty('UserEditable'))
39 return !property.UserEditable;
40 if (property.hasOwnProperty('DeviceEditable'))
41 return !property.DeviceEditable;
42 return true;
43 },
44
45
46 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698