diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 06:51:53 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 06:51:53 +0000 |
commit | 11086c713c607949e147f4005541ade5282cc7bb (patch) | |
tree | 759a39cef0421db530871005b0257a888d6fce59 /chrome/browser/chromeos | |
parent | d8b874bf0be545c52e002965bf93f32cdfbf2f81 (diff) | |
download | chromium_src-11086c713c607949e147f4005541ade5282cc7bb.zip chromium_src-11086c713c607949e147f4005541ade5282cc7bb.tar.gz chromium_src-11086c713c607949e147f4005541ade5282cc7bb.tar.bz2 |
Revert 111668 - Configure flimflam from ONC.
BUG=chromium-os:19399
TEST=manual
Review URL: http://codereview.chromium.org/8429004
TBR=chocobo@chromium.org
Review URL: http://codereview.chromium.org/8718006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_parser.cc | 118 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_parser.h | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 92 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_parser.cc | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_parser.h | 25 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/onc_network_parser.cc | 46 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/onc_network_parser.h | 3 |
8 files changed, 62 insertions, 237 deletions
diff --git a/chrome/browser/chromeos/cros/native_network_parser.cc b/chrome/browser/chromeos/cros/native_network_parser.cc index b2d905e..c8e18ce3 100644 --- a/chrome/browser/chromeos/cros/native_network_parser.cc +++ b/chrome/browser/chromeos/cros/native_network_parser.cc @@ -138,41 +138,6 @@ EnumMapper<PropertyIndex>::Pair property_index_table[] = { { flimflam::kWifiPhyMode, PROPERTY_INDEX_WIFI_PHY_MODE }, }; -EnumMapper<ConnectionType>::Pair type_table[] = { - { flimflam::kTypeEthernet, TYPE_ETHERNET }, - { flimflam::kTypeWifi, TYPE_WIFI }, - { flimflam::kTypeWimax, TYPE_WIMAX }, - { flimflam::kTypeBluetooth, TYPE_BLUETOOTH }, - { flimflam::kTypeCellular, TYPE_CELLULAR }, - { flimflam::kTypeVPN, TYPE_VPN }, -}; - -EnumMapper<ConnectionSecurity>::Pair security_table[] = { - { flimflam::kSecurityNone, SECURITY_NONE }, - { flimflam::kSecurityWep, SECURITY_WEP }, - { flimflam::kSecurityWpa, SECURITY_WPA }, - { flimflam::kSecurityRsn, SECURITY_RSN }, - { flimflam::kSecurityPsk, SECURITY_PSK }, - { flimflam::kSecurity8021x, SECURITY_8021X }, -}; - -EnumMapper<EAPMethod>::Pair eap_method_table[] = { - { flimflam::kEapMethodPEAP, EAP_METHOD_PEAP }, - { flimflam::kEapMethodTLS, EAP_METHOD_TLS }, - { flimflam::kEapMethodTTLS, EAP_METHOD_TTLS }, - { flimflam::kEapMethodLEAP, EAP_METHOD_LEAP }, -}; - -EnumMapper<EAPPhase2Auth>::Pair eap_auth_table[] = { - { flimflam::kEapPhase2AuthPEAPMD5, EAP_PHASE_2_AUTH_MD5 }, - { flimflam::kEapPhase2AuthPEAPMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, - { flimflam::kEapPhase2AuthTTLSMD5, EAP_PHASE_2_AUTH_MD5 }, - { flimflam::kEapPhase2AuthTTLSMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, - { flimflam::kEapPhase2AuthTTLSMSCHAP, EAP_PHASE_2_AUTH_MSCHAP }, - { flimflam::kEapPhase2AuthTTLSPAP, EAP_PHASE_2_AUTH_PAP }, - { flimflam::kEapPhase2AuthTTLSCHAP, EAP_PHASE_2_AUTH_CHAP }, -}; - // Serve the singleton mapper instance. const EnumMapper<PropertyIndex>* get_native_mapper() { CR_DEFINE_STATIC_LOCAL(EnumMapper<PropertyIndex>, mapper, @@ -182,6 +147,20 @@ const EnumMapper<PropertyIndex>* get_native_mapper() { return &mapper; } +ConnectionType ParseNetworkType(const std::string& type) { + static EnumMapper<ConnectionType>::Pair table[] = { + { flimflam::kTypeEthernet, TYPE_ETHERNET }, + { flimflam::kTypeWifi, TYPE_WIFI }, + { flimflam::kTypeWimax, TYPE_WIMAX }, + { flimflam::kTypeBluetooth, TYPE_BLUETOOTH }, + { flimflam::kTypeCellular, TYPE_CELLULAR }, + { flimflam::kTypeVPN, TYPE_VPN }, + }; + CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionType>, parser, + (table, arraysize(table), TYPE_UNKNOWN)); + return parser.Get(type); +} + } // namespace // -------------------- NativeNetworkDeviceParser -------------------- @@ -411,7 +390,7 @@ bool NativeNetworkDeviceParser::ParseValue( } ConnectionType NativeNetworkDeviceParser::ParseType(const std::string& type) { - return NativeNetworkParser::type_mapper()->Get(type); + return ParseNetworkType(type); } bool NativeNetworkDeviceParser::ParseApnList(const ListValue& list, @@ -525,37 +504,9 @@ const EnumMapper<PropertyIndex>* NativeNetworkParser::property_mapper() { return get_native_mapper(); } -// static -const EnumMapper<ConnectionType>* NativeNetworkParser::type_mapper() { - CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionType>, type_mapper, - (type_table, arraysize(type_table), TYPE_UNKNOWN)); - return &type_mapper; -} - -// static -const EnumMapper<ConnectionSecurity>* NativeNetworkParser::security_mapper() { - CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionSecurity>, security_mapper, - (security_table, arraysize(security_table), SECURITY_UNKNOWN)); - return &security_mapper; -} - -// static -const EnumMapper<EAPMethod>* NativeNetworkParser::eap_method_mapper() { - CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPMethod>, eap_method_mapper, - (eap_method_table, arraysize(eap_method_table), EAP_METHOD_UNKNOWN)); - return &eap_method_mapper; -} - -// static -const EnumMapper<EAPPhase2Auth>* NativeNetworkParser::eap_auth_mapper() { - CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPPhase2Auth>, eap_auth_mapper, - (eap_auth_table, arraysize(eap_auth_table), EAP_PHASE_2_AUTH_AUTO)); - return &eap_auth_mapper; -} - const ConnectionType NativeNetworkParser::ParseConnectionType( const std::string& connection_type) { - return type_mapper()->Get(connection_type); + return ParseNetworkType(connection_type); } Network* NativeNetworkParser::CreateNewNetwork( @@ -660,7 +611,7 @@ bool NativeNetworkParser::ParseValue(PropertyIndex index, } ConnectionType NativeNetworkParser::ParseType(const std::string& type) { - return type_mapper()->Get(type); + return ParseNetworkType(type); } ConnectionType NativeNetworkParser::ParseTypeFromDictionary( @@ -1082,16 +1033,45 @@ bool NativeWifiNetworkParser::ParseValue(PropertyIndex index, ConnectionSecurity NativeWifiNetworkParser::ParseSecurity( const std::string& security) { - return security_mapper()->Get(security); + static EnumMapper<ConnectionSecurity>::Pair table[] = { + { flimflam::kSecurityNone, SECURITY_NONE }, + { flimflam::kSecurityWep, SECURITY_WEP }, + { flimflam::kSecurityWpa, SECURITY_WPA }, + { flimflam::kSecurityRsn, SECURITY_RSN }, + { flimflam::kSecurityPsk, SECURITY_PSK }, + { flimflam::kSecurity8021x, SECURITY_8021X }, + }; + CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionSecurity>, parser, + (table, arraysize(table), SECURITY_UNKNOWN)); + return parser.Get(security); } EAPMethod NativeWifiNetworkParser::ParseEAPMethod(const std::string& method) { - return eap_method_mapper()->Get(method); + static EnumMapper<EAPMethod>::Pair table[] = { + { flimflam::kEapMethodPEAP, EAP_METHOD_PEAP }, + { flimflam::kEapMethodTLS, EAP_METHOD_TLS }, + { flimflam::kEapMethodTTLS, EAP_METHOD_TTLS }, + { flimflam::kEapMethodLEAP, EAP_METHOD_LEAP }, + }; + CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPMethod>, parser, + (table, arraysize(table), EAP_METHOD_UNKNOWN)); + return parser.Get(method); } EAPPhase2Auth NativeWifiNetworkParser::ParseEAPPhase2Auth( const std::string& auth) { - return eap_auth_mapper()->Get(auth); + static EnumMapper<EAPPhase2Auth>::Pair table[] = { + { flimflam::kEapPhase2AuthPEAPMD5, EAP_PHASE_2_AUTH_MD5 }, + { flimflam::kEapPhase2AuthPEAPMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, + { flimflam::kEapPhase2AuthTTLSMD5, EAP_PHASE_2_AUTH_MD5 }, + { flimflam::kEapPhase2AuthTTLSMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, + { flimflam::kEapPhase2AuthTTLSMSCHAP, EAP_PHASE_2_AUTH_MSCHAP }, + { flimflam::kEapPhase2AuthTTLSPAP, EAP_PHASE_2_AUTH_PAP }, + { flimflam::kEapPhase2AuthTTLSCHAP, EAP_PHASE_2_AUTH_CHAP }, + }; + CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPPhase2Auth>, parser, + (table, arraysize(table), EAP_PHASE_2_AUTH_AUTO)); + return parser.Get(auth); } // -------------------- NativeVirtualNetworkParser -------------------- diff --git a/chrome/browser/chromeos/cros/native_network_parser.h b/chrome/browser/chromeos/cros/native_network_parser.h index df4fb9e..b42892e 100644 --- a/chrome/browser/chromeos/cros/native_network_parser.h +++ b/chrome/browser/chromeos/cros/native_network_parser.h @@ -61,10 +61,6 @@ class NativeNetworkParser : public NetworkParser { NativeNetworkParser(); virtual ~NativeNetworkParser(); static const EnumMapper<PropertyIndex>* property_mapper(); - static const EnumMapper<ConnectionType>* type_mapper(); - static const EnumMapper<ConnectionSecurity>* security_mapper(); - static const EnumMapper<EAPMethod>* eap_method_mapper(); - static const EnumMapper<EAPPhase2Auth>* eap_auth_mapper(); static const ConnectionType ParseConnectionType(const std::string& type); protected: virtual Network* CreateNewNetwork(ConnectionType type, diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index a362caf..fd2c9c2 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -18,7 +18,6 @@ #include "base/i18n/icu_encoding_detection.h" #include "base/i18n/icu_string_conversions.h" #include "base/i18n/time_formatting.h" -#include "base/json/json_writer.h" // for debug output only. #include "base/metrics/histogram.h" #include "base/stl_util.h" #include "base/string_number_conversions.h" @@ -316,22 +315,6 @@ GValue* ConvertValueToGValue(const Value* value) { return new GValue(); } -GHashTable* ConvertDictionaryValueToGValueMap(const DictionaryValue* dict) { - GHashTable* ghash = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - for (DictionaryValue::key_iterator it = dict->begin_keys(); - it != dict->end_keys(); ++it) { - std::string key = *it; - Value* val = NULL; - if (dict->Get(key, &val)) { - g_hash_table_insert(ghash, - g_strdup(const_cast<char*>(key.c_str())), - ConvertValueToGValue(val)); - } - } - return ghash; -} - } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -403,19 +386,6 @@ void Network::SetNetworkParser(NetworkParser* parser) { network_parser_.reset(parser); } -void Network::UpdatePropertyMap(PropertyIndex index, const base::Value& value) { - // Add the property to property_map_. Delete previous value if necessary. - Value*& entry = property_map_[index]; - delete entry; - entry = value.DeepCopy(); - if (VLOG_IS_ON(2)) { - std::string value_json; - base::JSONWriter::Write(&value, true, &value_json); - VLOG(2) << "Updated property map on network: " - << unique_id() << "[" << index << "] = " << value_json; - } -} - void Network::SetState(ConnectionState new_state) { if (new_state == state_) return; @@ -1493,10 +1463,6 @@ class NetworkLibraryImplBase : public NetworkLibrary { const std::string& service_name, const std::string& server_hostname, ProviderType provider_type) = 0; - // Call to configure a wifi service. The identifier is either a service_path - // or a GUID. |info| is a dictionary of property values. - virtual void CallConfigureService(const std::string& identifier, - const DictionaryValue* info) = 0; // Called from NetworkConnectStart. // Calls NetworkConnectCompleted when the connection attept completes. virtual void CallConnectToNetwork(Network* network) = 0; @@ -2831,17 +2797,7 @@ bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob) { return false; } - DictionaryValue dict; - for (Network::PropertyMap::const_iterator props = - network->property_map_.begin(); - props != network->property_map_.end(); ++props) { - std::string key = - NativeNetworkParser::property_mapper()->GetKey(props->first); - if (!key.empty()) - dict.SetWithoutPathExpansion(key, props->second->DeepCopy()); - } - - CallConfigureService(network->unique_id(), &dict); + // TODO(chocobo): Pass parsed network values to flimflam update network. } return parser.GetNetworkConfigsSize() != 0; } @@ -3340,8 +3296,6 @@ class NetworkLibraryImplCros : public NetworkLibraryImplBase { virtual void MonitorNetworkDeviceStop( const std::string& device_path) OVERRIDE; - virtual void CallConfigureService(const std::string& identifier, - const DictionaryValue* info) OVERRIDE; virtual void CallConnectToNetwork(Network* network) OVERRIDE; virtual void CallRequestWifiNetworkAndConnect( const std::string& ssid, ConnectionSecurity security) OVERRIDE; @@ -3405,11 +3359,6 @@ class NetworkLibraryImplCros : public NetworkLibraryImplBase { NetworkMethodErrorType error, const char* error_message); - static void ConfigureServiceCallback(void* object, - const char* service_path, - NetworkMethodErrorType error, - const char* error_message); - static void NetworkConnectCallback(void* object, const char* service_path, NetworkMethodErrorType error, @@ -3668,27 +3617,6 @@ void NetworkLibraryImplCros::UpdateNetworkDeviceStatus( // NetworkLibraryImplBase connect implementation. // static callback -void NetworkLibraryImplCros::ConfigureServiceCallback( - void* object, - const char* service_path, - NetworkMethodErrorType error, - const char* error_message) { - DCHECK(CrosLibrary::Get()->libcros_loaded()); - if (error != NETWORK_METHOD_ERROR_NONE) { - LOG(WARNING) << "Error from ConfigureService callback for: " - << service_path - << " Error: " << error << " Message: " << error_message; - } -} - -void NetworkLibraryImplCros::CallConfigureService(const std::string& identifier, - const DictionaryValue* info) { - GHashTable* ghash = ConvertDictionaryValueToGValueMap(info); - chromeos::ConfigureService(identifier.c_str(), ghash, - ConfigureServiceCallback, this); -} - -// static callback void NetworkLibraryImplCros::NetworkConnectCallback( void* object, const char* service_path, @@ -4775,8 +4703,6 @@ class NetworkLibraryImplStub : public NetworkLibraryImplBase { virtual void MonitorNetworkDeviceStop( const std::string& device_path) OVERRIDE {} - virtual void CallConfigureService(const std::string& identifier, - const DictionaryValue* info) OVERRIDE {} virtual void CallConnectToNetwork(Network* network) OVERRIDE; virtual void CallRequestWifiNetworkAndConnect( const std::string& ssid, ConnectionSecurity security) OVERRIDE; @@ -4993,22 +4919,6 @@ void NetworkLibraryImplStub::Init() { // autotest browser_tests sometimes conclude the device is offline. CHECK(active_network()->connected()); CHECK(connected_network()->is_active()); - - std::string test_blob( - "{" - " \"NetworkConfigurations\": [" - " {" - " \"GUID\": \"guid\"," - " \"Type\": \"WiFi\"," - " \"WiFi\": {" - " \"Security\": \"WEP\"," - " \"SSID\": \"MySSID\"," - " }" - " }" - " ]," - " \"Certificates\": []" - "}"); - LoadOncNetworks(test_blob); } //////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h index e9e09f7..938bf60 100644 --- a/chrome/browser/chromeos/cros/network_library.h +++ b/chrome/browser/chromeos/cros/network_library.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ #pragma once -#include <map> #include <string> #include <vector> @@ -673,9 +672,6 @@ class Network { NetworkParser* network_parser() { return network_parser_.get(); } void SetNetworkParser(NetworkParser* parser); - // Updates the properties map for the corresponding property index. - void UpdatePropertyMap(PropertyIndex index, const base::Value& value); - // Set the state and update flags if necessary. void SetState(ConnectionState state); @@ -704,8 +700,6 @@ class Network { void set_unique_id(const std::string& unique_id) { unique_id_ = unique_id; } private: - typedef std::map<PropertyIndex, base::Value*> PropertyMap; - // This allows NetworkParser and its subclasses access to device // privates so that they can be reconstituted during parsing. The // parsers only access things through the private set_ functions so @@ -795,10 +789,6 @@ class Network { // network layer. scoped_ptr<NetworkParser> network_parser_; - // This map stores the set of properties for the network. - // Not all properties in this map are exposed via get methods. - PropertyMap property_map_; - DISALLOW_COPY_AND_ASSIGN(Network); }; diff --git a/chrome/browser/chromeos/cros/network_parser.cc b/chrome/browser/chromeos/cros/network_parser.cc index 12629a9..cd2f250 100644 --- a/chrome/browser/chromeos/cros/network_parser.cc +++ b/chrome/browser/chromeos/cros/network_parser.cc @@ -128,7 +128,6 @@ bool NetworkParser::UpdateStatus(const std::string& key, PropertyIndex found_index = mapper().Get(key); if (index) *index = found_index; - network->UpdatePropertyMap(found_index, value); if (!ParseValue(found_index, value, network)) { VLOG(1) << "Unhandled key '" << key << "' in Network: " << network->name() << " ID: " << network->unique_id() diff --git a/chrome/browser/chromeos/cros/network_parser.h b/chrome/browser/chromeos/cros/network_parser.h index a1a53e2..510e96a 100644 --- a/chrome/browser/chromeos/cros/network_parser.h +++ b/chrome/browser/chromeos/cros/network_parser.h @@ -52,10 +52,8 @@ class EnumMapper { EnumMapper(const Pair* list, size_t num_entries, EnumType unknown) : unknown_value_(unknown) { - for (size_t i = 0; i < num_entries; ++i, ++list) { + for (size_t i = 0; i < num_entries; ++i, ++list) enum_map_[list->key] = list->value; - inverse_enum_map_[list->value] = list->key; - } } EnumType Get(const std::string& type) const { @@ -65,20 +63,10 @@ class EnumMapper { return unknown_value_; } - std::string GetKey(EnumType type) const { - InverseEnumMapConstIter iter = inverse_enum_map_.find(type); - if (iter != inverse_enum_map_.end()) - return iter->second; - return std::string(); - } - private: typedef typename std::map<std::string, EnumType> EnumMap; - typedef typename std::map<EnumType, std::string> InverseEnumMap; typedef typename EnumMap::const_iterator EnumMapConstIter; - typedef typename InverseEnumMap::const_iterator InverseEnumMapConstIter; EnumMap enum_map_; - InverseEnumMap inverse_enum_map_; EnumType unknown_value_; DISALLOW_COPY_AND_ASSIGN(EnumMapper); }; @@ -133,24 +121,19 @@ class NetworkParser { public: virtual ~NetworkParser(); - // Called when a new network is encountered. In addition to setting the - // members on the Network object, the Network's property_map_ variable - // will include all the property and corresponding value in |info|. - // Returns NULL upon failure. + // Called when a new network is encountered. Returns NULL upon failure. virtual Network* CreateNetworkFromInfo(const std::string& service_path, const base::DictionaryValue& info); // Called when an existing network is has new information that needs - // to be updated. Network's property_map_ variable will be updated. - // Returns false upon failure. + // to be updated. Returns false upon failure. virtual bool UpdateNetworkFromInfo(const base::DictionaryValue& info, Network* network); // Called when an individual attribute of an existing network has // changed. |index| is a return value that supplies the appropriate // property index for the given key. |index| is filled in even if - // the update fails. Network's property_map_ variable will be updated. - // Returns false upon failure. + // the update fails. Returns false upon failure. virtual bool UpdateStatus(const std::string& key, const base::Value& value, Network* network, diff --git a/chrome/browser/chromeos/cros/onc_network_parser.cc b/chrome/browser/chromeos/cros/onc_network_parser.cc index a629087..40beafb 100644 --- a/chrome/browser/chromeos/cros/onc_network_parser.cc +++ b/chrome/browser/chromeos/cros/onc_network_parser.cc @@ -9,7 +9,6 @@ #include "base/stringprintf.h" #include "base/values.h" #include "chrome/browser/chromeos/cros/native_network_constants.h" -#include "chrome/browser/chromeos/cros/native_network_parser.h" #include "chrome/browser/chromeos/cros/network_library.h" #include "net/base/cert_database.h" #include "net/base/crypto_module.h" @@ -150,6 +149,7 @@ bool OncNetworkParser::ParseCertificate(int cert_index) { } Network* OncNetworkParser::ParseNetwork(int n) { + // TODO(chocobo): Change this to parse network into a dictionary. if (!network_configs_) return NULL; DictionaryValue* info = NULL; @@ -166,10 +166,6 @@ Network* OncNetworkParser::CreateNetworkFromInfo( if (type == TYPE_UNKNOWN) // Return NULL if cannot parse network type. return NULL; scoped_ptr<Network> network(CreateNewNetwork(type, service_path)); - // Update property with native value for type. - std::string str = NativeNetworkParser::type_mapper()->GetKey(type); - network->UpdatePropertyMap(PROPERTY_INDEX_TYPE, - *Value::CreateStringValue(str)); // Get the child dictionary with properties for the network. // And copy all the values from this network type dictionary to parent. @@ -177,9 +173,6 @@ Network* OncNetworkParser::CreateNetworkFromInfo( if (!info.GetDictionary(GetTypeFromDictionary(info), &dict)) return NULL; - // Add GUID from the parent dictionary. - dict->SetString("GUID", GetGuidFromDictionary(info)); - UpdateNetworkFromInfo(*dict, network.get()); VLOG(2) << "Created Network '" << network->name() << "' from info. Path:" << service_path @@ -215,13 +208,6 @@ std::string OncNetworkParser::GetTypeFromDictionary( return type_string; } -std::string OncNetworkParser::GetGuidFromDictionary( - const base::DictionaryValue& info) { - std::string guid_string; - info.GetString("GUID", &guid_string); - return guid_string; -} - bool OncNetworkParser::ParseServerOrCaCertificate( int cert_index, const std::string& cert_type, @@ -367,12 +353,7 @@ bool OncWifiNetworkParser::ParseValue(PropertyIndex index, std::string security_string; if (!value.GetAsString(&security_string)) break; - ConnectionSecurity security = ParseSecurity(security_string); - wifi_network->set_encryption(security); - // Also update property with native value for security. - std::string str = - NativeNetworkParser::security_mapper()->GetKey(security); - wifi_network->UpdatePropertyMap(index, *Value::CreateStringValue(str)); + wifi_network->set_encryption(ParseSecurity(security_string)); return true; } case PROPERTY_INDEX_PASSPHRASE: { @@ -400,7 +381,6 @@ bool OncWifiNetworkParser::ParseValue(PropertyIndex index, DCHECK(res); if (res) { PropertyIndex index = mapper().Get(key); - wifi_network->UpdatePropertyMap(index, *eap_value); if (!ParseEAPValue(index, *eap_value, wifi_network)) VLOG(1) << network->name() << ": EAP unhandled key: " << key << " Type: " << eap_value->GetType(); @@ -427,27 +407,17 @@ bool OncWifiNetworkParser::ParseEAPValue(PropertyIndex index, return true; } case PROPERTY_INDEX_EAP_METHOD: { - std::string eap_method_str; - if (!value.GetAsString(&eap_method_str)) + std::string eap_method; + if (!value.GetAsString(&eap_method)) break; - EAPMethod eap_method = ParseEAPMethod(eap_method_str); - wifi_network->set_eap_method(eap_method); - // Also update property with native value for EAP method. - std::string str = - NativeNetworkParser::eap_method_mapper()->GetKey(eap_method); - wifi_network->UpdatePropertyMap(index, *Value::CreateStringValue(str)); + wifi_network->set_eap_method(ParseEAPMethod(eap_method)); return true; } case PROPERTY_INDEX_EAP_PHASE_2_AUTH: { - std::string eap_phase_2_auth_str; - if (!value.GetAsString(&eap_phase_2_auth_str)) + std::string eap_phase_2_auth; + if (!value.GetAsString(&eap_phase_2_auth)) break; - EAPPhase2Auth eap_phase_2_auth = ParseEAPPhase2Auth(eap_phase_2_auth_str); - wifi_network->set_eap_phase_2_auth(eap_phase_2_auth); - // Also update property with native value for EAP phase 2 auth. - std::string str = - NativeNetworkParser::eap_auth_mapper()->GetKey(eap_phase_2_auth); - wifi_network->UpdatePropertyMap(index, *Value::CreateStringValue(str)); + wifi_network->set_eap_phase_2_auth(ParseEAPPhase2Auth(eap_phase_2_auth)); return true; } case PROPERTY_INDEX_EAP_ANONYMOUS_IDENTITY: { diff --git a/chrome/browser/chromeos/cros/onc_network_parser.h b/chrome/browser/chromeos/cros/onc_network_parser.h index 2c717ae..66d382e 100644 --- a/chrome/browser/chromeos/cros/onc_network_parser.h +++ b/chrome/browser/chromeos/cros/onc_network_parser.h @@ -63,9 +63,6 @@ class OncNetworkParser : public NetworkParser { // Returns the type string from the dictionary of network values. std::string GetTypeFromDictionary(const base::DictionaryValue& info); - // Returns the GUID string from the dictionary of network values. - std::string GetGuidFromDictionary(const base::DictionaryValue& info); - private: bool ParseServerOrCaCertificate( int cert_index, |