Index: chrome/browser/chromeos/cros/native_network_parser.h |
diff --git a/chrome/browser/chromeos/cros/native_network_parser.h b/chrome/browser/chromeos/cros/native_network_parser.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ee9d1b757cc40cf9a29490e54ef12b9acd6c8887 |
--- /dev/null |
+++ b/chrome/browser/chromeos/cros/native_network_parser.h |
@@ -0,0 +1,136 @@ |
+// 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; |
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.
|
+ 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(); |
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
|
+ private: |
+ 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: |
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
|
+ virtual ConnectionSecurity ParseSecurity(const std::string& security); |
+ virtual EAPMethod ParseEAPMethod(const std::string& method); |
+ virtual 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: |
+ virtual ActivationState ParseActivationState(const std::string& state); |
+ virtual NetworkTechnology ParseNetworkTechnology( |
+ const std::string& technology); |
+ virtual 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: |
+ virtual bool ParseProviderValue(PropertyIndex index, |
+ const Value& value, |
+ VirtualNetwork* network); |
+ virtual ProviderType ParseProviderType(const std::string& type); |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(NativeVirtualNetworkParser); |
+}; |
+ |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_CROS_NATIVE_NETWORK_PARSER_H_ |