OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wifi_sync/network_state_helper_chromeos.h" | 5 #include "components/sync_wifi/network_state_helper_chromeos.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chromeos/network/network_state.h" | 10 #include "chromeos/network/network_state.h" |
11 #include "chromeos/network/network_state_handler.h" | 11 #include "chromeos/network/network_state_handler.h" |
12 #include "chromeos/network/network_type_pattern.h" | 12 #include "chromeos/network/network_type_pattern.h" |
13 #include "components/wifi_sync/wifi_security_class.h" | 13 #include "components/sync_wifi/wifi_security_class.h" |
14 | 14 |
15 namespace wifi_sync { | 15 namespace sync_wifi { |
16 | 16 |
17 WifiCredential::CredentialSet GetWifiCredentialsForShillProfile( | 17 WifiCredential::CredentialSet GetWifiCredentialsForShillProfile( |
18 chromeos::NetworkStateHandler* network_state_handler, | 18 chromeos::NetworkStateHandler* network_state_handler, |
19 const std::string& shill_profile_path) { | 19 const std::string& shill_profile_path) { |
20 DCHECK(network_state_handler); | 20 DCHECK(network_state_handler); |
21 | 21 |
22 chromeos::NetworkStateHandler::NetworkStateList networks; | 22 chromeos::NetworkStateHandler::NetworkStateList networks; |
23 network_state_handler->GetNetworkListByType( | 23 network_state_handler->GetNetworkListByType( |
24 chromeos::NetworkTypePattern::WiFi(), | 24 chromeos::NetworkTypePattern::WiFi(), true /* configured_only */, |
25 true /* configured_only */, | 25 false /* visible_only */, 0 /* unlimited result size */, &networks); |
26 false /* visible_only */, | |
27 0 /* unlimited result size */, | |
28 &networks); | |
29 | 26 |
30 auto credentials(WifiCredential::MakeSet()); | 27 auto credentials(WifiCredential::MakeSet()); |
31 for (const chromeos::NetworkState* network : networks) { | 28 for (const chromeos::NetworkState* network : networks) { |
32 if (network->profile_path() != shill_profile_path) | 29 if (network->profile_path() != shill_profile_path) |
33 continue; | 30 continue; |
34 | 31 |
35 // TODO(quiche): Fill in the actual passphrase via an asynchronous | 32 // TODO(quiche): Fill in the actual passphrase via an asynchronous |
36 // call to a chromeos::NetworkConfigurationHandler instance's | 33 // call to a chromeos::NetworkConfigurationHandler instance's |
37 // GetProperties method. | 34 // GetProperties method. |
38 std::unique_ptr<WifiCredential> credential = WifiCredential::Create( | 35 std::unique_ptr<WifiCredential> credential = WifiCredential::Create( |
39 network->raw_ssid(), | 36 network->raw_ssid(), |
40 WifiSecurityClassFromShillSecurity(network->security_class()), | 37 WifiSecurityClassFromShillSecurity(network->security_class()), |
41 "" /* empty passphrase */); | 38 "" /* empty passphrase */); |
42 if (!credential) | 39 if (!credential) |
43 LOG(ERROR) << "Failed to create credential"; | 40 LOG(ERROR) << "Failed to create credential"; |
44 else | 41 else |
45 credentials.insert(*credential); | 42 credentials.insert(*credential); |
46 } | 43 } |
47 return credentials; | 44 return credentials; |
48 } | 45 } |
49 | 46 |
50 } // namespace wifi_sync | 47 } // namespace sync_wifi |
OLD | NEW |