Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: ui/chromeos/network/network_state_notifier.cc

Issue 762633002: Use NetworkConnectionObserver to trigger connect failure notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/chromeos/network/network_state_notifier.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/chromeos/network/network_state_notifier.cc
diff --git a/ui/chromeos/network/network_state_notifier.cc b/ui/chromeos/network/network_state_notifier.cc
index a5b5ac5308973501e54f1611d8b7a35ee194d3a7..eb211c2cabe40c084872f6195bfa11e37fe2cfc0 100644
--- a/ui/chromeos/network/network_state_notifier.cc
+++ b/ui/chromeos/network/network_state_notifier.cc
@@ -100,6 +100,7 @@ NetworkStateNotifier::NetworkStateNotifier(NetworkConnect* network_connect)
NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
handler->AddObserver(this, FROM_HERE);
UpdateDefaultNetwork(handler->DefaultNetwork());
+ NetworkHandler::Get()->network_connection_handler()->AddObserver(this);
}
NetworkStateNotifier::~NetworkStateNotifier() {
@@ -107,6 +108,23 @@ NetworkStateNotifier::~NetworkStateNotifier() {
return;
NetworkHandler::Get()->network_state_handler()->RemoveObserver(this,
FROM_HERE);
+ NetworkHandler::Get()->network_connection_handler()->RemoveObserver(this);
+}
+
+void NetworkStateNotifier::ConnectFailed(const std::string& service_path,
+ const std::string& error_name) {
+ // Only show a notification for certain errors. Other failures are expected
+ // to be handled by the UI that initiated the connect request.
+ // Note: kErrorConnectFailed may also cause the configure dialog to be
+ // displayed, but we rely on the notification system to show additional
+ // details if available.
+ if (error_name != NetworkConnectionHandler::kErrorConnectFailed &&
+ error_name != NetworkConnectionHandler::kErrorNotFound &&
+ error_name != NetworkConnectionHandler::kErrorConfigureFailed &&
+ error_name != NetworkConnectionHandler::kErrorCertLoadTimeout) {
+ return;
+ }
+ ShowNetworkConnectError(error_name, service_path);
}
void NetworkStateNotifier::DefaultNetworkChanged(const NetworkState* network) {
@@ -316,7 +334,7 @@ void NetworkStateNotifier::ShowConnectErrorNotification(
return;
}
- error = network_connect_->GetErrorString(shill_error, service_path);
+ error = network_connect_->GetShillErrorString(shill_error, service_path);
if (error.empty())
error = l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
}
« no previous file with comments | « ui/chromeos/network/network_state_notifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698