diff options
author | stevenjb <stevenjb@chromium.org> | 2015-04-14 12:49:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-14 19:50:54 +0000 |
commit | e22e5bcbad2cea941993b32e6cc3b082822a42fc (patch) | |
tree | 4b769cf0ca87ecdc6f2a30b18a54559940269893 /ui/chromeos | |
parent | e6a653183ba2a1c4f24990904dfc78e32c975f5b (diff) | |
download | chromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.zip chromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.tar.gz chromium_src-e22e5bcbad2cea941993b32e6cc3b082822a42fc.tar.bz2 |
Use networkingPrivate.startConnect
This adds checks for unconfigured or non-activated networks to internet_details.js since it no longer uses the checks in network_connect.cc.
It also moves some notification handling from network_connect.cc to network_state_notifier.cc so that it does not rely on network_connect.cc.
BUG=430115
Review URL: https://codereview.chromium.org/1043343002
Cr-Commit-Position: refs/heads/master@{#325108}
Diffstat (limited to 'ui/chromeos')
-rw-r--r-- | ui/chromeos/network/network_connect.cc | 16 | ||||
-rw-r--r-- | ui/chromeos/network/network_state_notifier.cc | 9 | ||||
-rw-r--r-- | ui/chromeos/network/network_state_notifier.h | 8 |
3 files changed, 14 insertions, 19 deletions
diff --git a/ui/chromeos/network/network_connect.cc b/ui/chromeos/network/network_connect.cc index 380a6db..e492f12 100644 --- a/ui/chromeos/network/network_connect.cc +++ b/ui/chromeos/network/network_connect.cc @@ -207,20 +207,6 @@ void NetworkConnectImpl::OnConnectFailed( scoped_ptr<base::DictionaryValue> error_data) { NET_LOG_ERROR("Connect Failed: " + error_name, service_path); - // If a new connect attempt canceled this connect, or a connect attempt to - // the same network is in progress, no need to notify the user here since they - // will be notified when the new or existing attempt completes. - if (error_name == NetworkConnectionHandler::kErrorConnectCanceled || - error_name == NetworkConnectionHandler::kErrorConnecting) { - return; - } - - // Already connected to the network, show the settings UI for the network. - if (error_name == NetworkConnectionHandler::kErrorConnected) { - ShowNetworkSettingsForPath(service_path); - return; - } - if (error_name == NetworkConnectionHandler::kErrorBadPassphrase || error_name == NetworkConnectionHandler::kErrorPassphraseRequired || error_name == NetworkConnectionHandler::kErrorConfigurationRequired || @@ -247,7 +233,6 @@ void NetworkConnectImpl::OnConnectFailed( void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) { NET_LOG_USER("Connect Succeeded", service_path); - network_state_notifier_->RemoveConnectNotification(); } // If |check_error_state| is true, error state for the network is checked, @@ -255,7 +240,6 @@ void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) { // networks or repeat connect attempts). void NetworkConnectImpl::CallConnectToNetwork(const std::string& service_path, bool check_error_state) { - network_state_notifier_->RemoveConnectNotification(); NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( service_path, base::Bind(&NetworkConnectImpl::OnConnectSucceeded, weak_factory_.GetWeakPtr(), service_path), diff --git a/ui/chromeos/network/network_state_notifier.cc b/ui/chromeos/network/network_state_notifier.cc index fbb02d1..3bcbb67 100644 --- a/ui/chromeos/network/network_state_notifier.cc +++ b/ui/chromeos/network/network_state_notifier.cc @@ -118,6 +118,15 @@ NetworkStateNotifier::~NetworkStateNotifier() { NetworkHandler::Get()->network_connection_handler()->RemoveObserver(this); } +void NetworkStateNotifier::ConnectToNetworkRequested( + const std::string& service_path) { + RemoveConnectNotification(); +} + +void NetworkStateNotifier::ConnectSucceeded(const std::string& service_path) { + RemoveConnectNotification(); +} + void NetworkStateNotifier::ConnectFailed(const std::string& service_path, const std::string& error_name) { // Only show a notification for certain errors. Other failures are expected diff --git a/ui/chromeos/network/network_state_notifier.h b/ui/chromeos/network/network_state_notifier.h index 85741ea..3f5efd0 100644 --- a/ui/chromeos/network/network_state_notifier.h +++ b/ui/chromeos/network/network_state_notifier.h @@ -45,6 +45,8 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier ~NetworkStateNotifier() override; // NetworkConnectionObserver + void ConnectToNetworkRequested(const std::string& service_path) override; + void ConnectSucceeded(const std::string& service_path) override; void ConnectFailed(const std::string& service_path, const std::string& error_name) override; void DiconnectRequested(const std::string& service_path) override; @@ -65,9 +67,6 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier // Show a mobile activation error notification. void ShowMobileActivationError(const std::string& service_path); - // Removes any existing connect notifications. - void RemoveConnectNotification(); - static const char kNotifierNetwork[]; static const char kNotifierNetworkError[]; static const char kNetworkConnectNotificationId[]; @@ -90,6 +89,9 @@ class UI_CHROMEOS_EXPORT NetworkStateNotifier const base::DictionaryValue& shill_properties); void ShowVpnDisconnectedNotification(const chromeos::NetworkState* vpn); + // Removes any existing connect notifications. + void RemoveConnectNotification(); + // Returns true if the default network changed. bool UpdateDefaultNetwork(const chromeos::NetworkState* network); |