Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/browser/chromeos/cros/native_network_parser.h

Issue 23618026: NOT FOR SUBMIT: Remove NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NATIVE_NETWORK_PARSER_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_NATIVE_NETWORK_PARSER_H_
7
8 #include <string>
9
10 #include "chrome/browser/chromeos/cros/network_parser.h"
11 #include "base/compiler_specific.h" // for OVERRIDE
12
13 namespace base {
14 class DictionaryValue;
15 class ListValue;
16 class Value;
17 }
18
19 namespace chromeos {
20
21 // This is the network device parser that parses the data from the
22 // network stack on the native platform. Currently it parses
23 // Shill-provided information.
24 class NativeNetworkDeviceParser : public NetworkDeviceParser {
25 public:
26 NativeNetworkDeviceParser();
27 virtual ~NativeNetworkDeviceParser();
28
29 protected:
30 virtual NetworkDevice* CreateNewNetworkDevice(
31 const std::string& device_path) OVERRIDE;
32 virtual bool ParseValue(PropertyIndex index,
33 const base::Value& value,
34 NetworkDevice* device) OVERRIDE;
35 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
36
37 // Parsing helper routines specific to native network devices.
38 virtual bool ParseApnList(const base::ListValue& list,
39 CellularApnList* apn_list);
40 virtual bool ParseFoundNetworksFromList(const base::ListValue& list,
41 CellularNetworkList* found_networks);
42 virtual SimLockState ParseSimLockState(const std::string& state);
43 virtual bool ParseSimLockStateFromDictionary(
44 const base::DictionaryValue& info,
45 SimLockState* out_state,
46 int* out_retries,
47 bool* out_enabled);
48 virtual TechnologyFamily ParseTechnologyFamily(
49 const std::string& technology_family);
50
51 private:
52 DISALLOW_COPY_AND_ASSIGN(NativeNetworkDeviceParser);
53 };
54
55 // This is the network parser that parses the data from the network
56 // stack on the native platform. Currently it parses
57 // Shill-provided information.
58 class NativeNetworkParser : public NetworkParser {
59 public:
60 NativeNetworkParser();
61 virtual ~NativeNetworkParser();
62 static const EnumMapper<PropertyIndex>* property_mapper();
63 static const EnumMapper<ConnectionType>* network_type_mapper();
64 static const EnumMapper<ConnectionSecurity>* network_security_mapper();
65 static const EnumMapper<EAPMethod>* network_eap_method_mapper();
66 static const EnumMapper<EAPPhase2Auth>* network_eap_auth_mapper();
67 static const ConnectionType ParseConnectionType(const std::string& type);
68 protected:
69 virtual Network* CreateNewNetwork(ConnectionType type,
70 const std::string& service_path) OVERRIDE;
71 virtual bool ParseValue(PropertyIndex index,
72 const base::Value& value,
73 Network* network) OVERRIDE;
74 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
75 virtual ConnectionType ParseTypeFromDictionary(
76 const base::DictionaryValue& info) OVERRIDE;
77
78 ConnectionState ParseState(const std::string& state);
79 ConnectionError ParseError(const std::string& error);
80
81 private:
82 DISALLOW_COPY_AND_ASSIGN(NativeNetworkParser);
83 };
84
85 // Below are specific types of network parsers.
86 class NativeEthernetNetworkParser : public NativeNetworkParser {
87 public:
88 NativeEthernetNetworkParser();
89 virtual ~NativeEthernetNetworkParser();
90 private:
91 // NOTE: Uses base class ParseValue, etc.
92
93 DISALLOW_COPY_AND_ASSIGN(NativeEthernetNetworkParser);
94 };
95
96 // Base for wireless networks.
97 class NativeWirelessNetworkParser : public NativeNetworkParser {
98 public:
99 NativeWirelessNetworkParser();
100 virtual ~NativeWirelessNetworkParser();
101 virtual bool ParseValue(PropertyIndex index,
102 const base::Value& value,
103 Network* network) OVERRIDE;
104 private:
105 DISALLOW_COPY_AND_ASSIGN(NativeWirelessNetworkParser);
106 };
107
108 class NativeWifiNetworkParser : public NativeWirelessNetworkParser {
109 public:
110 NativeWifiNetworkParser();
111 virtual ~NativeWifiNetworkParser();
112 virtual bool ParseValue(PropertyIndex index,
113 const base::Value& value,
114 Network* network) OVERRIDE;
115 protected:
116 ConnectionSecurity ParseSecurity(const std::string& security);
117 EAPMethod ParseEAPMethod(const std::string& method);
118 EAPPhase2Auth ParseEAPPhase2Auth(const std::string& auth);
119 private:
120 DISALLOW_COPY_AND_ASSIGN(NativeWifiNetworkParser);
121 };
122
123 class NativeWimaxNetworkParser : public NativeWifiNetworkParser {
124 public:
125 NativeWimaxNetworkParser();
126 virtual ~NativeWimaxNetworkParser();
127 virtual bool ParseValue(PropertyIndex index,
128 const base::Value& value,
129 Network* network) OVERRIDE;
130
131 private:
132 DISALLOW_COPY_AND_ASSIGN(NativeWimaxNetworkParser);
133 };
134
135 class NativeCellularNetworkParser : public NativeWirelessNetworkParser {
136 public:
137 NativeCellularNetworkParser();
138 virtual ~NativeCellularNetworkParser();
139 virtual bool ParseValue(PropertyIndex index,
140 const base::Value& value,
141 Network* network) OVERRIDE;
142 protected:
143 ActivationState ParseActivationState(const std::string& state);
144 NetworkTechnology ParseNetworkTechnology(
145 const std::string& technology);
146 NetworkRoamingState ParseRoamingState(
147 const std::string& roaming_state);
148 private:
149 DISALLOW_COPY_AND_ASSIGN(NativeCellularNetworkParser);
150 };
151
152 class NativeVirtualNetworkParser : public NativeNetworkParser {
153 public:
154 NativeVirtualNetworkParser();
155 virtual ~NativeVirtualNetworkParser();
156 virtual bool ParseValue(PropertyIndex index,
157 const base::Value& value,
158 Network* network) OVERRIDE;
159 virtual bool UpdateNetworkFromInfo(const base::DictionaryValue& info,
160 Network* network) OVERRIDE;
161 static const EnumMapper<ProviderType>* provider_type_mapper();
162 protected:
163 bool ParseProviderValue(PropertyIndex index,
164 const base::Value& value,
165 VirtualNetwork* network);
166 ProviderType ParseProviderType(const std::string& type);
167 private:
168 DISALLOW_COPY_AND_ASSIGN(NativeVirtualNetworkParser);
169 };
170
171
172 } // namespace chromeos
173
174 #endif // CHROME_BROWSER_CHROMEOS_CROS_NATIVE_NETWORK_PARSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/native_network_constants.cc ('k') | chrome/browser/chromeos/cros/native_network_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698