| 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() { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return undefined; | 126 return undefined; |
| 127 if (property['UserEditable']) | 127 if (property['UserEditable']) |
| 128 return property['UserPolicy']; | 128 return property['UserPolicy']; |
| 129 if (property['DeviceEditable']) | 129 if (property['DeviceEditable']) |
| 130 return property['DevicePolicy']; | 130 return property['DevicePolicy']; |
| 131 // No value recommended by policy. | 131 // No value recommended by policy. |
| 132 return undefined; | 132 return undefined; |
| 133 }, | 133 }, |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * Returns the Source of this configuration. If undefined returns 'None'. |
| 137 * @return {string} The configuration source: 'None', 'User', 'Device', |
| 138 * 'UserPolicy', or 'DevicePolicy'. |
| 139 */ |
| 140 getSource: function() { |
| 141 var source = this.getActiveValue('Source'); |
| 142 if (source == undefined) |
| 143 return 'None'; |
| 144 return source; |
| 145 }, |
| 146 |
| 147 /** |
| 148 * Returns the WiFi security type (defaults to 'None'). |
| 149 * @return {string} The security type. |
| 150 */ |
| 151 getWiFiSecurity: function() { |
| 152 var security = this.getActiveValue('WiFi.Security'); |
| 153 if (security == undefined) |
| 154 return 'None'; |
| 155 return security; |
| 156 }, |
| 157 |
| 158 /** |
| 136 * Updates the properties of |data_| from the properties in |update|. | 159 * Updates the properties of |data_| from the properties in |update|. |
| 137 * Note: this only looks at top level entries, so if a dictionary is | 160 * Note: this only looks at top level entries, so if a dictionary is |
| 138 * updated the entire dictionary is written over. TODO(stevenjb): | 161 * updated the entire dictionary is written over. TODO(stevenjb): |
| 139 * eliminate this function when |data_| contains only ONC entries and | 162 * eliminate this function when |data_| contains only ONC entries and |
| 140 * any updates consist of complete ONC dictionaries. | 163 * any updates consist of complete ONC dictionaries. |
| 141 * @param {Object} update Dictionary containing the updated properties. | 164 * @param {Object} update Dictionary containing the updated properties. |
| 142 */ | 165 */ |
| 143 updateData: function(update) { | 166 updateData: function(update) { |
| 144 for (var prop in update) { | 167 for (var prop in update) { |
| 145 if (prop in this.data_) | 168 if (prop in this.data_) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 160 return property[effective]; | 183 return property[effective]; |
| 161 } | 184 } |
| 162 return undefined; | 185 return undefined; |
| 163 } | 186 } |
| 164 }; | 187 }; |
| 165 | 188 |
| 166 return { | 189 return { |
| 167 OncData: OncData | 190 OncData: OncData |
| 168 }; | 191 }; |
| 169 }); | 192 }); |
| OLD | NEW |