diff options
Diffstat (limited to 'chrome/browser/chromeos/cros/network_library.cc')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 6075332..8278ce4 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -93,11 +93,20 @@ void NetworkLibrary::ConnectToWifiNetwork(WifiNetwork network, void NetworkLibrary::ConnectToWifiNetwork(const string16& ssid, const string16& password) { if (CrosLibrary::EnsureLoaded()) { - // TODO(chocobo): Implement connect to hidden network. // First create a service from hidden network. - // Now connect to that service.. -// chromeos::ConnectToNetwork(service_path, -// password.empty() ? NULL : UTF16ToUTF8(password).c_str()); + chromeos::ServiceInfo* service = + chromeos::GetWifiService(UTF16ToUTF8(ssid).c_str(), + chromeos::SECURITY_UNKNOWN); + // Now connect to that service. + if (service) { + chromeos::ConnectToNetwork(service->service_path, + password.empty() ? NULL : UTF16ToUTF8(password).c_str()); + // Clean up ServiceInfo object. + chromeos::FreeServiceInfo(service); + } else { + LOG(WARNING) << "Cannot find hidden network: " << ssid; + // TODO(chocobo): Show error message. + } } } |