OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/chromeos/cros/network_parser.h" | 14 #include "chrome/browser/chromeos/cros/enum_mapper.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 class Network; | 18 class Network; |
19 class NetworkPropertyUIData; | 19 class NetworkPropertyUIData; |
20 | 20 |
21 // Helper for accessing and setting values in the network's UI data dictionary. | 21 // Helper for accessing and setting values in the network's UI data dictionary. |
22 // Accessing values is done via static members that take the network as an | 22 // Accessing values is done via static members that take the network as an |
23 // argument. In order to fill a UI data dictionary, construct an instance, set | 23 // argument. In order to fill a UI data dictionary, construct an instance, set |
24 // up your data members, and call FillDictionary(). For example, if you have a | 24 // up your data members, and call FillDictionary(). For example, if you have a |
25 // |network|: | 25 // |network|: |
26 // | 26 // |
27 // NetworkUIData ui_data; | 27 // NetworkUIData ui_data; |
28 // ui_data.set_onc_source(NetworkUIData::ONC_SOURCE_USER_IMPORT); | 28 // ui_data.set_onc_source(NetworkUIData::ONC_SOURCE_USER_IMPORT); |
29 // NetworkPropertyUIData auto_connect_property( | 29 // NetworkPropertyUIData auto_connect_property( |
30 // NetworkPropertyUIData::CONTROLLER_USER, | 30 // NetworkPropertyUIData::CONTROLLER_USER, |
31 // base::Value::CreateBooleanValue(true)); | 31 // base::Value::CreateBooleanValue(true)); |
32 // ui_data.SetProperty(NetworkUIData::kPropertyAutoConnect, | 32 // ui_data.SetProperty(NetworkUIData::kPropertyAutoConnect, |
33 // auto_connect_property); | 33 // auto_connect_property); |
34 // ui_data.FillDictionary(network->ui_data()); | 34 // ui_data.FillDictionary(network->ui_data()); |
35 class NetworkUIData { | 35 class NetworkUIData { |
36 public: | 36 public: |
37 // Indicates from which source an ONC blob comes from. | 37 // Indicates from which source an ONC blob comes from. |
38 enum ONCSource { | 38 enum ONCSource { |
39 ONC_SOURCE_NONE, | 39 ONC_SOURCE_NONE, |
40 ONC_SOURCE_USER_IMPORT, | 40 ONC_SOURCE_USER_IMPORT, |
kmixter1
2011/12/06 12:52:37
Oh nice - so you will know which came from manual
| |
41 ONC_SOURCE_DEVICE_POLICY, | 41 ONC_SOURCE_DEVICE_POLICY, |
42 ONC_SOURCE_USER_POLICY, | 42 ONC_SOURCE_USER_POLICY, |
43 }; | 43 }; |
44 | 44 |
45 // Constructs a new dictionary builder. | 45 // Constructs a new dictionary builder. |
46 NetworkUIData(); | 46 NetworkUIData(); |
47 ~NetworkUIData(); | 47 ~NetworkUIData(); |
48 | 48 |
49 // Sets the ONC source. | 49 // Sets the ONC source. |
50 void set_onc_source(ONCSource onc_source) { onc_source_ = onc_source; } | 50 void set_onc_source(ONCSource onc_source) { onc_source_ = onc_source; } |
(...skipping 17 matching lines...) Expand all Loading... | |
68 | 68 |
69 // Per-property meta data. This is handled by NetworkPropertyUIData. | 69 // Per-property meta data. This is handled by NetworkPropertyUIData. |
70 static const char kKeyProperties[]; | 70 static const char kKeyProperties[]; |
71 | 71 |
72 // Property names for per-property dat | 72 // Property names for per-property dat |
73 static const char kPropertyAutoConnect[]; | 73 static const char kPropertyAutoConnect[]; |
74 static const char kPropertyPreferred[]; | 74 static const char kPropertyPreferred[]; |
75 static const char kPropertyPassphrase[]; | 75 static const char kPropertyPassphrase[]; |
76 static const char kPropertySaveCredentials[]; | 76 static const char kPropertySaveCredentials[]; |
77 | 77 |
78 static const char kPropertyVPNCaCertNss[]; | 78 static const char kPropertyVPNCaCertNss[]; |
kmixter1
2011/12/06 12:52:37
why do we have to have copies of all the property
Mattias Nissler (ping if slow)
2011/12/06 13:37:59
Because I didn't want to leak ONC structural detai
| |
79 static const char kPropertyVPNPskPassphrase[]; | 79 static const char kPropertyVPNPskPassphrase[]; |
80 static const char kPropertyVPNClientCertId[]; | 80 static const char kPropertyVPNClientCertId[]; |
81 static const char kPropertyVPNUsername[]; | 81 static const char kPropertyVPNUsername[]; |
82 static const char kPropertyVPNUserPassphrase[]; | 82 static const char kPropertyVPNUserPassphrase[]; |
83 static const char kPropertyVPNGroupName[]; | 83 static const char kPropertyVPNGroupName[]; |
84 | 84 |
85 static const char kPropertyEAPMethod[]; | 85 static const char kPropertyEAPMethod[]; |
86 static const char kPropertyEAPPhase2Auth[]; | 86 static const char kPropertyEAPPhase2Auth[]; |
87 static const char kPropertyEAPServerCaCertNssNickname[]; | 87 static const char kPropertyEAPServerCaCertNssNickname[]; |
88 static const char kPropertyEAPClientCertPkcs11Id[]; | 88 static const char kPropertyEAPClientCertPkcs11Id[]; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 156 |
157 // So it can access the kKeyXYZ constants. | 157 // So it can access the kKeyXYZ constants. |
158 friend class NetworkUIDataTest; | 158 friend class NetworkUIDataTest; |
159 | 159 |
160 DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData); | 160 DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData); |
161 }; | 161 }; |
162 | 162 |
163 } // namespace chromeos | 163 } // namespace chromeos |
164 | 164 |
165 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ | 165 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ |
OLD | NEW |