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

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

Issue 7453051: This factors out all of the parsing code from the network library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reducing friends to minimal set. Created 9 years, 4 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 #pragma once
8
9 #include "chrome/browser/chromeos/cros/network_parser.h"
10 #include "base/compiler_specific.h" // for OVERRIDE
11
12 namespace chromeos {
13
14 // This is the network device parser that parses the data from the
15 // network stack on the native platform. Currently it parses
16 // FlimFlam-provided information.
17 class NativeNetworkDeviceParser : public NetworkDeviceParser {
18 public:
19 NativeNetworkDeviceParser();
20 virtual ~NativeNetworkDeviceParser();
21 virtual bool ParseValue(PropertyIndex index,
22 const Value& value,
23 NetworkDevice* device) OVERRIDE;
24 protected:
25 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
26
27 // Parsing helper routines specific to native network devices.
28 virtual bool ParseApnList(const ListValue& list, CellularApnList* apn_list);
29 virtual bool ParseFoundNetworksFromList(const ListValue& list,
30 CellularNetworkList* found_networks);
31 virtual SimLockState ParseSimLockState(const std::string& state);
32 virtual bool ParseSimLockStateFromDictionary(const DictionaryValue& info,
33 SimLockState* out_state,
34 int* out_retries);
35 virtual TechnologyFamily ParseTechnologyFamily(
36 const std::string& technology_family);
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(NativeNetworkDeviceParser);
40 };
41
42 // This is the network parser that parses the data from the network
43 // stack on the native platform. Currently it parses
44 // FlimFlam-provided information.
45 class NativeNetworkParser : public NetworkParser {
46 public:
47 NativeNetworkParser();
48 virtual ~NativeNetworkParser();
49 static const EnumMapper<PropertyIndex>* property_mapper();
50 static const ConnectionType ParseConnectionType(const std::string& type);
51 protected:
52 virtual bool ParseValue(PropertyIndex index,
53 const Value& value,
54 Network* network) OVERRIDE;
55 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
56 virtual ConnectionType ParseTypeFromDictionary(
57 const DictionaryValue& info) OVERRIDE;
58 virtual ConnectionMode ParseMode(const std::string& mode) OVERRIDE;
59 virtual ConnectionState ParseState(const std::string& state) OVERRIDE;
60 virtual ConnectionError ParseError(const std::string& error) OVERRIDE;
61 private:
62 DISALLOW_COPY_AND_ASSIGN(NativeNetworkParser);
63 };
64
65 // Below are specific types of network parsers.
66 class NativeEthernetNetworkParser : public NativeNetworkParser {
67 public:
68 NativeEthernetNetworkParser();
69 virtual ~NativeEthernetNetworkParser();
70 private:
71 // NOTE: Uses base class ParseValue, etc.
72
73 DISALLOW_COPY_AND_ASSIGN(NativeEthernetNetworkParser);
74 };
75
76 // Base for wireless networks.
77 class NativeWirelessNetworkParser : public NativeNetworkParser {
78 public:
79 NativeWirelessNetworkParser();
80 virtual ~NativeWirelessNetworkParser();
81 virtual bool ParseValue(PropertyIndex index,
82 const Value& value,
83 Network* network) OVERRIDE;
84 private:
85 DISALLOW_COPY_AND_ASSIGN(NativeWirelessNetworkParser);
86 };
87
88 class NativeWifiNetworkParser : public NativeWirelessNetworkParser {
89 public:
90 NativeWifiNetworkParser();
91 virtual ~NativeWifiNetworkParser();
92 virtual bool ParseValue(PropertyIndex index,
93 const Value& value,
94 Network* network) OVERRIDE;
95 protected:
96 ConnectionSecurity ParseSecurity(const std::string& security);
97 EAPMethod ParseEAPMethod(const std::string& method);
98 EAPPhase2Auth ParseEAPPhase2Auth(const std::string& auth);
99 private:
100 DISALLOW_COPY_AND_ASSIGN(NativeWifiNetworkParser);
101 };
102
103 class NativeCellularNetworkParser : public NativeWirelessNetworkParser {
104 public:
105 NativeCellularNetworkParser();
106 virtual ~NativeCellularNetworkParser();
107 virtual bool ParseValue(PropertyIndex index,
108 const Value& value,
109 Network* network) OVERRIDE;
110 protected:
111 ActivationState ParseActivationState(const std::string& state);
112 NetworkTechnology ParseNetworkTechnology(
113 const std::string& technology);
114 NetworkRoamingState ParseRoamingState(
115 const std::string& roaming_state);
116 private:
117 DISALLOW_COPY_AND_ASSIGN(NativeCellularNetworkParser);
118 };
119
120 class NativeVirtualNetworkParser : public NativeNetworkParser {
121 public:
122 NativeVirtualNetworkParser();
123 virtual ~NativeVirtualNetworkParser();
124 virtual bool ParseValue(PropertyIndex index,
125 const Value& value,
126 Network* network) OVERRIDE;
127 virtual bool UpdateNetworkFromInfo(const DictionaryValue& info,
128 Network* network) OVERRIDE;
129 protected:
130 bool ParseProviderValue(PropertyIndex index,
131 const Value& value,
132 VirtualNetwork* network);
133 ProviderType ParseProviderType(const std::string& type);
134 private:
135 DISALLOW_COPY_AND_ASSIGN(NativeVirtualNetworkParser);
136 };
137
138
139 } // namespace chromeos
140
141 #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