summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc17
-rw-r--r--chrome/browser/chromeos/cros/network_library.h2
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc2
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);
}