Chromium Code Reviews| Index: chrome/browser/chromeos/options/network_connect.cc |
| diff --git a/chrome/browser/chromeos/options/network_connect.cc b/chrome/browser/chromeos/options/network_connect.cc |
| index 63c72068f1edf07ba017d825419d51adc8c62d30..7595faae7e63a13dffa6a13297fad366c34be42a 100644 |
| --- a/chrome/browser/chromeos/options/network_connect.cc |
| +++ b/chrome/browser/chromeos/options/network_connect.cc |
| @@ -15,6 +15,7 @@ |
| #include "chrome/browser/chromeos/cros/network_library.h" |
| #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| #include "chrome/browser/chromeos/options/network_config_view.h" |
| +#include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| #include "chromeos/chromeos_switches.h" |
| @@ -135,14 +136,10 @@ ConnectResult ConnectToNetwork(const std::string& service_path, |
| if (network->type() == TYPE_ETHERNET) |
| return CONNECT_NOT_STARTED; // Normally this shouldn't happen |
| - if (network->type() == TYPE_WIFI) { |
| - WifiNetwork* wifi = static_cast<WifiNetwork*>(network); |
| - wifi->SetEnrollmentDelegate( |
| - chromeos::CreateEnrollmentDelegate( |
| - parent_window, |
| - wifi->name(), |
| - ProfileManager::GetLastUsedProfile())); |
| - wifi->AttemptConnection(base::Bind(&DoConnect, wifi, parent_window)); |
| + if (network->type() == TYPE_WIFI || network->type() == TYPE_VPN) { |
| + network->SetEnrollmentDelegate(chromeos::CreateEnrollmentDelegate( |
| + parent_window, network->name(), ProfileManager::GetLastUsedProfile())); |
| + network->AttemptConnection(base::Bind(&DoConnect, network, parent_window)); |
| return CONNECT_STARTED; |
| } |
| @@ -164,20 +161,48 @@ ConnectResult ConnectToNetwork(const std::string& service_path, |
| return CONNECT_STARTED; |
| } |
| - if (network->type() == TYPE_VPN) { |
| - VirtualNetwork* vpn = static_cast<VirtualNetwork*>(network); |
| - vpn->SetEnrollmentDelegate( |
| - chromeos::CreateEnrollmentDelegate( |
| - parent_window, |
| - vpn->name(), |
| - ProfileManager::GetLastUsedProfile())); |
| - vpn->AttemptConnection(base::Bind(&DoConnect, vpn, parent_window)); |
| - return CONNECT_STARTED; |
| - } |
| - |
| NOTREACHED(); |
| return CONNECT_NOT_STARTED; |
| } |
| +void ConfigureNetwork(const std::string& service_path, |
| + gfx::NativeWindow parent_window) { |
| + NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
| + Network* network = cros->FindNetworkByPath(service_path); |
| + if (!network) |
|
pneubeck (no reviews)
2013/06/06 20:41:20
Maybe LOG(ERROR)/WARNING.
stevenjb
2013/06/07 03:44:58
Done.
|
| + return; |
| + |
| + if (network->type() == TYPE_WIFI || network->type() == TYPE_VPN) { |
| + network->SetEnrollmentDelegate(chromeos::CreateEnrollmentDelegate( |
| + parent_window, network->name(), ProfileManager::GetLastUsedProfile())); |
| + // This will connect to the network only if the network just needs to have |
| + // its certificate configured. Otherwise it will show an enrollment dialog |
| + // if available, or call NetworkConfigView::Show(). |
| + network->AttemptConnection( |
| + base::Bind(&NetworkConfigView::Show, network, parent_window)); |
| + return; |
| + } |
| + |
| + if (network->type() == TYPE_WIMAX) { |
| + NetworkConfigView::Show(network, parent_window); |
| + return; |
| + } |
| + |
| + if (network->type() == TYPE_CELLULAR) { |
| + CellularNetwork* cellular = static_cast<CellularNetwork*>(network); |
| + if (cellular->NeedsActivation()) { |
| + ActivateCellular(service_path); |
| + return; |
| + } else if (cellular->out_of_credits()) { |
| + ShowMobileSetup(service_path); |
| + return; |
| + } |
| + } |
| + |
| + // No special configure or setup for |service_path|, show the settings UI. |
| + ash::Shell::GetInstance()->system_tray_delegate()->ShowNetworkSettings( |
|
pneubeck (no reviews)
2013/06/06 20:41:20
This accesses ash to get the delegate that was pre
stevenjb
2013/06/07 03:44:58
Yeah, I agree, it's ugly. I really can't wait to r
|
| + service_path); |
| +} |
| + |
| } // namespace network_connect |
| } // namespace chromeos |