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 | 10 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return undefined; | 133 return undefined; |
134 if (property['UserEditable']) | 134 if (property['UserEditable']) |
135 return property['UserPolicy']; | 135 return property['UserPolicy']; |
136 if (property['DeviceEditable']) | 136 if (property['DeviceEditable']) |
137 return property['DevicePolicy']; | 137 return property['DevicePolicy']; |
138 // No value recommended by policy. | 138 // No value recommended by policy. |
139 return undefined; | 139 return undefined; |
140 }, | 140 }, |
141 | 141 |
142 /** | 142 /** |
| 143 * Returns true if the ONC property exists, false otherwise. |
| 144 * @param {string} key The property key. |
| 145 * @return {bool} Whether the property exists. |
| 146 */ |
| 147 hasValue: function(key) { |
| 148 var property = this.getManagedProperty(key); |
| 149 return property != undefined; |
| 150 }, |
| 151 |
| 152 /** |
143 * Returns the Source of this configuration. If undefined returns 'None'. | 153 * Returns the Source of this configuration. If undefined returns 'None'. |
144 * @return {string} The configuration source: 'None', 'User', 'Device', | 154 * @return {string} The configuration source: 'None', 'User', 'Device', |
145 * 'UserPolicy', or 'DevicePolicy'. | 155 * 'UserPolicy', or 'DevicePolicy'. |
146 */ | 156 */ |
147 getSource: function() { | 157 getSource: function() { |
148 var source = this.getActiveValue('Source'); | 158 var source = this.getActiveValue('Source'); |
149 if (source == undefined) | 159 if (source == undefined) |
150 return 'None'; | 160 return 'None'; |
151 assert(typeof source == 'string'); | 161 assert(typeof source == 'string'); |
152 return source; | 162 return source; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 */ | 194 */ |
185 getData: function() { | 195 getData: function() { |
186 return this.data_; | 196 return this.data_; |
187 } | 197 } |
188 }; | 198 }; |
189 | 199 |
190 return { | 200 return { |
191 OncData: OncData | 201 OncData: OncData |
192 }; | 202 }; |
193 }); | 203 }); |
OLD | NEW |