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 |
11 cr.exportPath('cr.onc'); | 11 cr.exportPath('cr.onc'); |
12 | 12 |
13 cr.define('cr.onc', function() { | 13 cr.define('cr.onc', function() { |
14 'use strict'; | 14 'use strict'; |
15 | 15 |
16 /** | 16 /** |
17 * @constructor | 17 * @constructor |
18 */ | 18 */ |
19 function OncData(data) { | 19 function OncData(data) { |
20 this.data_ = data; | 20 this.data_ = data; |
21 } | 21 } |
22 | 22 |
23 OncData.prototype = { | 23 OncData.prototype = { |
| 24 /** @return {string} The GUID of the network. */ |
| 25 guid: function() { return this.data_['GUID']; }, |
24 | 26 |
25 /** | 27 /** |
26 * Returns either a managed property dictionary or an unmanaged value. | 28 * Returns either a managed property dictionary or an unmanaged value. |
27 * @param {string} key The property key. | 29 * @param {string} key The property key. |
28 * @return {?} The property value or dictionary if it exists, otherwise | 30 * @return {?} The property value or dictionary if it exists, otherwise |
29 * undefined. | 31 * undefined. |
30 */ | 32 */ |
31 getManagedProperty: function(key) { | 33 getManagedProperty: function(key) { |
32 var data = this.data_; | 34 var data = this.data_; |
33 while (true) { | 35 while (true) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 */ | 186 */ |
185 getData: function() { | 187 getData: function() { |
186 return this.data_; | 188 return this.data_; |
187 } | 189 } |
188 }; | 190 }; |
189 | 191 |
190 return { | 192 return { |
191 OncData: OncData | 193 OncData: OncData |
192 }; | 194 }; |
193 }); | 195 }); |
OLD | NEW |