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

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

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