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