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

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: Finally working 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;
stevenjb 2011/08/05 18:46:58 Are the rest of these overrides (in which case we
Greg Spencer (Chromium) 2011/08/11 22:19:32 Done.
26 virtual bool ParseApnList(const ListValue& list, CellularApnList* apn_list);
27 virtual bool ParseFoundNetworksFromList(const ListValue& list,
28 CellularNetworkList* found_networks);
29 virtual SimLockState ParseSimLockState(const std::string& state);
30 virtual bool ParseSimLockStateFromDictionary(const DictionaryValue& info,
31 SimLockState* out_state,
32 int* out_retries);
33 virtual TechnologyFamily ParseTechnologyFamily(
34 const std::string& technology_family);
35 private:
36 DISALLOW_COPY_AND_ASSIGN(NativeNetworkDeviceParser);
37 };
38
39 // This is the network parser that parses the data from the network
40 // stack on the native platform. Currently it parses
41 // FlimFlam-provided information.
42 class NativeNetworkParser : public NetworkParser {
43 public:
44 NativeNetworkParser();
45 virtual ~NativeNetworkParser();
46 static const EnumMapper<PropertyIndex>* property_mapper();
47 static const ConnectionType ParseConnectionType(const std::string& type);
48 protected:
49 virtual bool ParseValue(PropertyIndex index,
50 const Value& value,
51 Network* network) OVERRIDE;
52 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
53 virtual ConnectionType ParseTypeFromDictionary(
54 const DictionaryValue& info) OVERRIDE;
55 virtual ConnectionMode ParseMode(const std::string& mode) OVERRIDE;
56 virtual ConnectionState ParseState(const std::string& state) OVERRIDE;
57 virtual ConnectionError ParseError(const std::string& error) OVERRIDE;
58 private:
59 DISALLOW_COPY_AND_ASSIGN(NativeNetworkParser);
60 };
61
62 // Below are specific types of network parsers.
63 class NativeEthernetNetworkParser : public NativeNetworkParser {
64 public:
65 NativeEthernetNetworkParser();
66 virtual ~NativeEthernetNetworkParser();
stevenjb 2011/08/05 18:46:58 Maybe add ParseValue() here, even if it just calls
Greg Spencer (Chromium) 2011/08/11 22:19:32 Well, but that adds an additional virtual function
stevenjb 2011/08/12 21:32:37 Fair enough. I don't think the overhead really mat
67 private:
68 DISALLOW_COPY_AND_ASSIGN(NativeEthernetNetworkParser);
69 };
70
71 // Base for wireless networks.
72 class NativeWirelessNetworkParser : public NativeNetworkParser {
73 public:
74 NativeWirelessNetworkParser();
75 virtual ~NativeWirelessNetworkParser();
76 virtual bool ParseValue(PropertyIndex index,
77 const Value& value,
78 Network* network) OVERRIDE;
79 private:
80 DISALLOW_COPY_AND_ASSIGN(NativeWirelessNetworkParser);
81 };
82
83 class NativeWifiNetworkParser : public NativeWirelessNetworkParser {
84 public:
85 NativeWifiNetworkParser();
86 virtual ~NativeWifiNetworkParser();
87 virtual bool ParseValue(PropertyIndex index,
88 const Value& value,
89 Network* network) OVERRIDE;
90 protected:
stevenjb 2011/08/05 18:46:58 Do want the following to be virtual, i.e. would it
Greg Spencer (Chromium) 2011/08/11 22:19:32 You're right. And they're just helper functions a
91 virtual ConnectionSecurity ParseSecurity(const std::string& security);
92 virtual EAPMethod ParseEAPMethod(const std::string& method);
93 virtual EAPPhase2Auth ParseEAPPhase2Auth(const std::string& auth);
94 private:
95 DISALLOW_COPY_AND_ASSIGN(NativeWifiNetworkParser);
96 };
97
98 class NativeCellularNetworkParser : public NativeWirelessNetworkParser {
99 public:
100 NativeCellularNetworkParser();
101 virtual ~NativeCellularNetworkParser();
102 virtual bool ParseValue(PropertyIndex index,
103 const Value& value,
104 Network* network) OVERRIDE;
105 protected:
106 virtual ActivationState ParseActivationState(const std::string& state);
107 virtual NetworkTechnology ParseNetworkTechnology(
108 const std::string& technology);
109 virtual NetworkRoamingState ParseRoamingState(
110 const std::string& roaming_state);
111 private:
112 DISALLOW_COPY_AND_ASSIGN(NativeCellularNetworkParser);
113 };
114
115 class NativeVirtualNetworkParser : public NativeNetworkParser {
116 public:
117 NativeVirtualNetworkParser();
118 virtual ~NativeVirtualNetworkParser();
119 virtual bool ParseValue(PropertyIndex index,
120 const Value& value,
121 Network* network) OVERRIDE;
122 virtual bool UpdateNetworkFromInfo(const DictionaryValue& info,
123 Network* network) OVERRIDE;
124 protected:
125 virtual bool ParseProviderValue(PropertyIndex index,
126 const Value& value,
127 VirtualNetwork* network);
128 virtual ProviderType ParseProviderType(const std::string& type);
129 private:
130 DISALLOW_COPY_AND_ASSIGN(NativeVirtualNetworkParser);
131 };
132
133
134 } // namespace chromeos
135
136 #endif // CHROME_BROWSER_CHROMEOS_CROS_NATIVE_NETWORK_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698