OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview ONC Data support class. Wraps a dictionary object containing | 6 * @fileoverview ONC Data support class. Wraps a dictionary object containing |
7 * ONC managed or unmanaged dictionaries. Supports nested dictionaries, | 7 * ONC managed or unmanaged dictionaries. Supports nested dictionaries, |
8 * e.g. data.getManagedProperty('VPN.Type'). | 8 * e.g. data.getManagedProperty('VPN.Type'). |
9 */ | 9 */ |
10 cr.define('cr.onc', function() { | 10 cr.define('cr.onc', function() { |
11 'use strict'; | 11 'use strict'; |
12 | 12 |
| 13 /** |
| 14 * @constructor |
| 15 */ |
13 function OncData(data) { | 16 function OncData(data) { |
14 this.data_ = data; | 17 this.data_ = data; |
15 // For convenience set 'type' to the active 'Type' value. | 18 // For convenience set 'type' to the active 'Type' value. |
16 this.type = this.getActiveValue('Type'); | 19 this.type = this.getActiveValue('Type'); |
17 } | 20 } |
18 | 21 |
19 OncData.prototype = { | 22 OncData.prototype = { |
20 | 23 |
21 /** | 24 /** |
22 * Returns either a managed property dictionary or an unmanaged value. | 25 * Returns either a managed property dictionary or an unmanaged value. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (property['UserEditable']) | 132 if (property['UserEditable']) |
130 return property['UserPolicy']; | 133 return property['UserPolicy']; |
131 if (property['DeviceEditable']) | 134 if (property['DeviceEditable']) |
132 return property['DevicePolicy']; | 135 return property['DevicePolicy']; |
133 // No value recommended by policy. | 136 // No value recommended by policy. |
134 return undefined; | 137 return undefined; |
135 }, | 138 }, |
136 | 139 |
137 /** | 140 /** |
138 * Get the effective value from a Managed property ONC dictionary. | 141 * Get the effective value from a Managed property ONC dictionary. |
139 * @param {object} property The managed property ONC dictionary. | 142 * @param {Object} property The managed property ONC dictionary. |
140 * @return {*} The effective value or undefined. | 143 * @return {*} The effective value or undefined. |
141 * @private | 144 * @private |
142 */ | 145 */ |
143 getEffectiveValueFromProperty_: function(property) { | 146 getEffectiveValueFromProperty_: function(property) { |
144 if ('Effective' in property) { | 147 if ('Effective' in property) { |
145 var effective = property.Effective; | 148 var effective = property.Effective; |
146 if (effective in property) | 149 if (effective in property) |
147 return property[effective]; | 150 return property[effective]; |
148 } | 151 } |
149 return undefined; | 152 return undefined; |
150 } | 153 } |
151 }; | 154 }; |
152 | 155 |
153 return { | 156 return { |
154 OncData: OncData | 157 OncData: OncData |
155 }; | 158 }; |
156 }); | 159 }); |
OLD | NEW |