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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 * @return {string} The security type. | 152 * @return {string} The security type. |
153 */ | 153 */ |
154 getWiFiSecurity: function() { | 154 getWiFiSecurity: function() { |
155 var security = this.getActiveValue('WiFi.Security'); | 155 var security = this.getActiveValue('WiFi.Security'); |
156 if (security == undefined) | 156 if (security == undefined) |
157 return 'None'; | 157 return 'None'; |
158 return security; | 158 return security; |
159 }, | 159 }, |
160 | 160 |
161 /** | 161 /** |
162 * Updates the properties of |data_| from the properties in |update|. | |
163 * Note: this only looks at top level entries, so if a dictionary is | |
164 * updated the entire dictionary is written over. TODO(stevenjb): | |
165 * eliminate this function when |data_| contains only ONC entries and | |
166 * any updates consist of complete ONC dictionaries. | |
167 * @param {Object} update Dictionary containing the updated properties. | |
168 */ | |
169 updateData: function(update) { | |
170 for (var prop in update) { | |
171 if (prop in this.data_) | |
172 this.data_[prop] = update[prop]; | |
173 } | |
174 }, | |
175 | |
176 /** | |
177 * Get the effective value from a Managed property ONC dictionary. | 162 * Get the effective value from a Managed property ONC dictionary. |
178 * @param {Object} property The managed property ONC dictionary. | 163 * @param {Object} property The managed property ONC dictionary. |
179 * @return {*} The effective value or undefined. | 164 * @return {*} The effective value or undefined. |
180 * @private | 165 * @private |
181 */ | 166 */ |
182 getEffectiveValueFromProperty_: function(property) { | 167 getEffectiveValueFromProperty_: function(property) { |
183 if ('Effective' in property) { | 168 if ('Effective' in property) { |
184 var effective = property.Effective; | 169 var effective = property.Effective; |
185 if (effective in property) | 170 if (effective in property) |
186 return property[effective]; | 171 return property[effective]; |
187 } | 172 } |
188 return undefined; | 173 return undefined; |
189 } | 174 } |
190 }; | 175 }; |
191 | 176 |
192 return { | 177 return { |
193 OncData: OncData | 178 OncData: OncData |
194 }; | 179 }; |
195 }); | 180 }); |
OLD | NEW |