OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chromeos/network/onc/onc_translator.h" | 5 #include "chromeos/network/onc/onc_translator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 bool save_credentials; | 322 bool save_credentials; |
323 if (onc_provider_type != ::onc::vpn::kThirdPartyVpn && | 323 if (onc_provider_type != ::onc::vpn::kThirdPartyVpn && |
324 shill_dictionary_->GetBooleanWithoutPathExpansion( | 324 shill_dictionary_->GetBooleanWithoutPathExpansion( |
325 shill::kSaveCredentialsProperty, &save_credentials)) { | 325 shill::kSaveCredentialsProperty, &save_credentials)) { |
326 SetNestedOncValue(provider_type_dictionary, ::onc::vpn::kSaveCredentials, | 326 SetNestedOncValue(provider_type_dictionary, ::onc::vpn::kSaveCredentials, |
327 base::FundamentalValue(save_credentials)); | 327 base::FundamentalValue(save_credentials)); |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 void ShillToONCTranslator::TranslateWiFiWithState() { | 331 void ShillToONCTranslator::TranslateWiFiWithState() { |
332 TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable, | 332 std::string shill_security; |
333 ::onc::wifi::kSecurity); | 333 std::string shill_key_mgmt; |
| 334 if (shill_dictionary_->GetStringWithoutPathExpansion( |
| 335 shill::kSecurityClassProperty, &shill_security) && |
| 336 shill_security == shill::kSecurityWep && |
| 337 shill_dictionary_->GetStringWithoutPathExpansion( |
| 338 shill::kEapKeyMgmtProperty, &shill_key_mgmt) && |
| 339 shill_key_mgmt == ::onc::wifi::kKeyMgmtIEEE8021X) { |
| 340 onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSecurity, |
| 341 ::onc::wifi::kWEP_8021X); |
| 342 } else { |
| 343 TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable, |
| 344 ::onc::wifi::kSecurity); |
| 345 } |
| 346 |
334 bool unknown_encoding = true; | 347 bool unknown_encoding = true; |
335 std::string ssid = shill_property_util::GetSSIDFromProperties( | 348 std::string ssid = shill_property_util::GetSSIDFromProperties( |
336 *shill_dictionary_, false /* verbose_logging */, &unknown_encoding); | 349 *shill_dictionary_, false /* verbose_logging */, &unknown_encoding); |
337 if (!unknown_encoding && !ssid.empty()) | 350 if (!unknown_encoding && !ssid.empty()) |
338 onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSSID, ssid); | 351 onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSSID, ssid); |
339 | 352 |
340 bool link_monitor_disable; | 353 bool link_monitor_disable; |
341 if (shill_dictionary_->GetBooleanWithoutPathExpansion( | 354 if (shill_dictionary_->GetBooleanWithoutPathExpansion( |
342 shill::kLinkMonitorDisableProperty, &link_monitor_disable)) { | 355 shill::kLinkMonitorDisableProperty, &link_monitor_disable)) { |
343 onc_object_->SetBooleanWithoutPathExpansion( | 356 onc_object_->SetBooleanWithoutPathExpansion( |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 const NetworkState* network_state) { | 778 const NetworkState* network_state) { |
766 CHECK(onc_signature != NULL); | 779 CHECK(onc_signature != NULL); |
767 | 780 |
768 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature, | 781 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature, |
769 network_state); | 782 network_state); |
770 return translator.CreateTranslatedONCObject(); | 783 return translator.CreateTranslatedONCObject(); |
771 } | 784 } |
772 | 785 |
773 } // namespace onc | 786 } // namespace onc |
774 } // namespace chromeos | 787 } // namespace chromeos |
OLD | NEW |