Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/wifi_sync/network_state_helper_chromeos.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chromeos/network/network_state.h" | |
| 9 #include "chromeos/network/network_state_handler.h" | |
| 10 #include "components/wifi_sync/wifi_credential.h" | |
|
erikwright (departed)
2014/12/08 21:21:36
not needed (in header)
mukesh agrawal
2014/12/09 01:41:11
Done.
| |
| 11 #include "components/wifi_sync/wifi_security_class.h" | |
| 12 | |
| 13 namespace wifi_sync { | |
| 14 | |
| 15 WifiCredential::CredentialSet GetWifiCredentialsForShillProfile( | |
| 16 chromeos::NetworkStateHandler* network_state_handler, | |
| 17 const std::string& shill_profile_path) { | |
| 18 DCHECK(network_state_handler); | |
| 19 | |
| 20 chromeos::NetworkStateHandler::NetworkStateList networks; | |
| 21 network_state_handler->GetNetworkListByType( | |
| 22 chromeos::NetworkTypePattern::WiFi(), | |
|
erikwright (departed)
2014/12/08 21:21:36
#include chromeos/network/network_type_pattern.h
mukesh agrawal
2014/12/09 01:41:10
Done.
| |
| 23 true /* configured_only */, | |
| 24 false /* visible_only */, | |
| 25 0 /* unlimited result size */, | |
| 26 &networks); | |
| 27 | |
| 28 auto credentials(WifiCredential::MakeSet()); | |
| 29 for (const chromeos::NetworkState* network : networks) { | |
| 30 if (network->profile_path() != shill_profile_path) | |
| 31 continue; | |
| 32 | |
| 33 // TODO(quiche): Switch away from network->security(), once we have | |
| 34 // a security_class() field in NetworkState. | |
| 35 // | |
| 36 // TODO(quiche): Fill in the actual passphrase via an asynchronous | |
| 37 // call to a chromeos::NetworkConfigurationHandler instance's | |
| 38 // GetProperties method. | |
| 39 credentials.insert( | |
| 40 WifiCredential(network->raw_ssid(), | |
| 41 WifiSecurityClassFromShillSecurity(network->security()), | |
| 42 "" /* empty passphrase */)); | |
| 43 } | |
| 44 return credentials; | |
| 45 } | |
| 46 | |
| 47 } // namespace wifi_sync | |
| OLD | NEW |