diff options
author | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-13 00:29:33 +0000 |
---|---|---|
committer | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-13 00:29:33 +0000 |
commit | b76be6c790b8f26ff68c2a15a29bfc3c41ed8088 (patch) | |
tree | 0d396a1143cf8a6e872ea1e562c77c69e61df46b | |
parent | 6cc630bdddda2daa5f62161ca9edb11d2b93d5b6 (diff) | |
download | chromium_src-b76be6c790b8f26ff68c2a15a29bfc3c41ed8088.zip chromium_src-b76be6c790b8f26ff68c2a15a29bfc3c41ed8088.tar.gz chromium_src-b76be6c790b8f26ff68c2a15a29bfc3c41ed8088.tar.bz2 |
Implement connect to hidden networks. And show passphrase in wifi config dialog.
Review URL: http://codereview.chromium.org/913003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41512 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 17 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.h | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/wifi_config_view.cc | 2 |
3 files changed, 17 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. + } } } diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h index ab0ee2dc6..e18e71f 100644 --- a/chrome/browser/chromeos/cros/network_library.h +++ b/chrome/browser/chromeos/cros/network_library.h @@ -44,6 +44,7 @@ struct WifiNetwork { ssid(service.name), encrypted(service.passphrase_required), encryption(service.security), + passphrase(service.passphrase), strength(service.strength), connecting(connecting), connected(connected), @@ -59,6 +60,7 @@ struct WifiNetwork { std::string ssid; bool encrypted; chromeos::ConnectionSecurity encryption; + std::string passphrase; int strength; bool connecting; bool connected; diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index 2e09b8d..6756131 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -103,6 +103,8 @@ void WifiConfigView::Init() { passphrase_textfield_ = new views::Textfield( views::Textfield::STYLE_PASSWORD); passphrase_textfield_->SetController(this); + if (!wifi_.passphrase.empty()) + passphrase_textfield_->SetText(UTF8ToUTF16(wifi_.passphrase)); layout->AddView(passphrase_textfield_); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); } |