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" | |
| 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 if (!network_state_handler) { | |
| 19 LOG(ERROR) << "network_state_handler is null"; | |
|
stevenjb
2014/12/05 20:28:17
Should this ever happen? Maybe just DCHECK?
mukesh agrawal
2014/12/05 23:48:11
Done.
| |
| 20 return WifiCredential::MakeSet(); | |
| 21 } | |
| 22 | |
| 23 chromeos::NetworkStateHandler::NetworkStateList networks; | |
| 24 network_state_handler->GetNetworkListByType( | |
| 25 chromeos::NetworkTypePattern::WiFi(), | |
| 26 true, /* configured_only */ | |
|
stevenjb
2014/12/05 20:28:17
nit: Either use /* */ inside the comma, or // outs
mukesh agrawal
2014/12/05 23:48:11
Done.
I wasn't sure if alignment applied to /**/
| |
| 27 false, /* visible_only */ | |
| 28 0, /* unlimited result size */ | |
| 29 &networks); | |
| 30 | |
| 31 auto credentials(WifiCredential::MakeSet()); | |
| 32 for (const chromeos::NetworkState* network : networks) { | |
| 33 DCHECK(network); | |
|
stevenjb
2014/12/05 20:28:17
Unnecessary.
mukesh agrawal
2014/12/05 23:48:11
Done.
| |
| 34 | |
| 35 if (network->profile_path() != shill_profile_path) { | |
| 36 continue; | |
| 37 } | |
|
stevenjb
2014/12/05 20:28:17
nit: no {}
mukesh agrawal
2014/12/05 23:48:10
Done.
| |
| 38 | |
| 39 // TODO(quiche): Switch away from network->security(), once we have | |
| 40 // a security_class() field in NetworkState. | |
|
stevenjb
2014/12/05 20:28:17
Is there any reason why NetworkState should know a
mukesh agrawal
2014/12/05 23:48:11
Good question. When we start adding networks, we w
stevenjb
2014/12/08 17:54:26
I looked through the Chrome code. We already have
mukesh agrawal
2014/12/09 01:23:50
Acknowledged. Migration to SecurityClass is underw
| |
| 41 // | |
| 42 // TODO(quiche): Fill in the actual passphrase via an asynchronous | |
| 43 // call to a chromeos::NetworkConfigurationHandler instance's | |
| 44 // GetProperties method. | |
|
stevenjb
2014/12/05 20:28:17
I don't think that Shill provides the passphrase v
mukesh agrawal
2014/12/05 23:48:11
Correct on both counts.
The plan is still to only
stevenjb
2014/12/08 17:54:26
Anything that depends on Fake behavior should clea
mukesh agrawal
2014/12/09 01:23:50
Acknowledged. Opened crbug.com/440206 for renaming
| |
| 45 credentials.insert( | |
| 46 WifiCredential(network->raw_ssid(), | |
| 47 WifiSecurityClassFromShillString(network->security()), | |
| 48 "" /* empty passphrase */)); | |
| 49 } | |
| 50 return credentials; | |
| 51 } | |
| 52 | |
| 53 } // namespace wifi_sync | |
| OLD | NEW |