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( | |
30 // NetworkPropertyUIData::CONTROLLER_USER, | |
31 // base::Value::CreateBooleanValue(true)); | |
32 // ui_data.SetProperty(NetworkUIData::kPropertyAutoConnect, | |
33 // auto_connect_property); | |
34 // ui_data.FillDictionary(network->ui_data()); | 29 // ui_data.FillDictionary(network->ui_data()); |
35 class NetworkUIData { | 30 class NetworkUIData { |
36 public: | 31 public: |
37 // Indicates from which source an ONC blob comes from. | 32 // Indicates from which source an ONC blob comes from. |
38 enum ONCSource { | 33 enum ONCSource { |
39 ONC_SOURCE_NONE, | 34 ONC_SOURCE_NONE, |
40 ONC_SOURCE_USER_IMPORT, | 35 ONC_SOURCE_USER_IMPORT, |
41 ONC_SOURCE_DEVICE_POLICY, | 36 ONC_SOURCE_DEVICE_POLICY, |
42 ONC_SOURCE_USER_POLICY, | 37 ONC_SOURCE_USER_POLICY, |
43 }; | 38 }; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 static const char kPropertyEAPClientCertPkcs11Id[]; | 83 static const char kPropertyEAPClientCertPkcs11Id[]; |
89 static const char kPropertyEAPUseSystemCAs[]; | 84 static const char kPropertyEAPUseSystemCAs[]; |
90 static const char kPropertyEAPIdentity[]; | 85 static const char kPropertyEAPIdentity[]; |
91 static const char kPropertyEAPAnonymousIdentity[]; | 86 static const char kPropertyEAPAnonymousIdentity[]; |
92 static const char kPropertyEAPPassphrase[]; | 87 static const char kPropertyEAPPassphrase[]; |
93 | 88 |
94 private: | 89 private: |
95 static EnumMapper<ONCSource>& GetONCSourceMapper(); | 90 static EnumMapper<ONCSource>& GetONCSourceMapper(); |
96 | 91 |
97 ONCSource onc_source_; | 92 ONCSource onc_source_; |
98 DictionaryValue properties_; | 93 DictionaryValue properties_; |
kmixter1
2011/12/13 01:44:07
I'm still not clear on what properties_ will conta
Mattias Nissler (ping if slow)
2011/12/13 13:52:19
Note that this gets removed in the other CL. This
kmixter1
2011/12/13 19:21:03
OK - makes sense now that I've reviewed the other
| |
99 | 94 |
100 static const EnumMapper<NetworkUIData::ONCSource>::Pair kONCSourceTable[]; | 95 static const EnumMapper<NetworkUIData::ONCSource>::Pair kONCSourceTable[]; |
101 | 96 |
102 DISALLOW_COPY_AND_ASSIGN(NetworkUIData); | 97 DISALLOW_COPY_AND_ASSIGN(NetworkUIData); |
103 }; | 98 }; |
104 | 99 |
105 // Holds meta information for a network property: Whether the property is under | 100 // Holds meta information for a network property: Whether the property is under |
106 // policy control, if it is user-editable, and whether the policy-provided | 101 // policy control, if it is user-editable, and whether the policy-provided |
107 // default value, if applicable. | 102 // default value, if applicable. |
108 class NetworkPropertyUIData { | 103 class NetworkPropertyUIData { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 151 |
157 // So it can access the kKeyXYZ constants. | 152 // So it can access the kKeyXYZ constants. |
158 friend class NetworkUIDataTest; | 153 friend class NetworkUIDataTest; |
159 | 154 |
160 DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData); | 155 DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData); |
161 }; | 156 }; |
162 | 157 |
163 } // namespace chromeos | 158 } // namespace chromeos |
164 | 159 |
165 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ | 160 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_ |
OLD | NEW |