| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/net/arc_net_host_impl.h" | 5 #include "components/arc/net/arc_net_host_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 443 } |
| 444 mojom::ConfiguredNetworkDetailsPtr details = | 444 mojom::ConfiguredNetworkDetailsPtr details = |
| 445 std::move(cfg->details->get_configured()); | 445 std::move(cfg->details->get_configured()); |
| 446 if (!details) { | 446 if (!details) { |
| 447 callback.Run(""); | 447 callback.Run(""); |
| 448 return; | 448 return; |
| 449 } | 449 } |
| 450 | 450 |
| 451 properties->SetStringWithoutPathExpansion(onc::network_config::kType, | 451 properties->SetStringWithoutPathExpansion(onc::network_config::kType, |
| 452 onc::network_config::kWiFi); | 452 onc::network_config::kWiFi); |
| 453 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kHexSSID, cfg->hexssid); | 453 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kHexSSID, |
| 454 cfg->hexssid.get()); |
| 454 wifi_dict->SetBooleanWithoutPathExpansion(onc::wifi::kAutoConnect, | 455 wifi_dict->SetBooleanWithoutPathExpansion(onc::wifi::kAutoConnect, |
| 455 details->autoconnect); | 456 details->autoconnect); |
| 456 if (cfg->security.get().empty()) { | 457 if (cfg->security.get().empty()) { |
| 457 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kSecurity, | 458 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kSecurity, |
| 458 onc::wifi::kSecurityNone); | 459 onc::wifi::kSecurityNone); |
| 459 } else { | 460 } else { |
| 460 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kSecurity, | 461 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kSecurity, |
| 461 cfg->security); | 462 cfg->security.get()); |
| 462 if (!details->passphrase.is_null()) { | 463 if (!details->passphrase.is_null()) { |
| 463 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kPassphrase, | 464 wifi_dict->SetStringWithoutPathExpansion(onc::wifi::kPassphrase, |
| 464 details->passphrase); | 465 details->passphrase.get()); |
| 465 } | 466 } |
| 466 } | 467 } |
| 467 properties->SetWithoutPathExpansion(onc::network_config::kWiFi, | 468 properties->SetWithoutPathExpansion(onc::network_config::kWiFi, |
| 468 std::move(wifi_dict)); | 469 std::move(wifi_dict)); |
| 469 | 470 |
| 470 std::string user_id_hash = chromeos::LoginState::Get()->primary_user_hash(); | 471 std::string user_id_hash = chromeos::LoginState::Get()->primary_user_hash(); |
| 471 GetManagedConfigurationHandler()->CreateConfiguration( | 472 GetManagedConfigurationHandler()->CreateConfiguration( |
| 472 user_id_hash, *properties, | 473 user_id_hash, *properties, |
| 473 base::Bind(&ArcNetHostImpl::CreateNetworkSuccessCallback, | 474 base::Bind(&ArcNetHostImpl::CreateNetworkSuccessCallback, |
| 474 weak_factory_.GetWeakPtr(), callback), | 475 weak_factory_.GetWeakPtr(), callback), |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 bool is_enabled = GetStateHandler()->IsTechnologyEnabled( | 646 bool is_enabled = GetStateHandler()->IsTechnologyEnabled( |
| 646 chromeos::NetworkTypePattern::WiFi()); | 647 chromeos::NetworkTypePattern::WiFi()); |
| 647 arc_bridge_service()->net()->instance()->WifiEnabledStateChanged(is_enabled); | 648 arc_bridge_service()->net()->instance()->WifiEnabledStateChanged(is_enabled); |
| 648 } | 649 } |
| 649 | 650 |
| 650 void ArcNetHostImpl::OnShuttingDown() { | 651 void ArcNetHostImpl::OnShuttingDown() { |
| 651 GetStateHandler()->RemoveObserver(this, FROM_HERE); | 652 GetStateHandler()->RemoveObserver(this, FROM_HERE); |
| 652 } | 653 } |
| 653 | 654 |
| 654 } // namespace arc | 655 } // namespace arc |
| OLD | NEW |