Commit fcb7a339 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

NetworkNotifier: Show config UI on error

Bug: 805357
Change-Id: Id3a6124a2fab1cfe40598d087aec86d82c567c70
Reviewed-on: https://chromium-review.googlesource.com/887635
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533029}
parent 8bbeef73
...@@ -110,6 +110,15 @@ base::string16 GetShillErrorString(const std::string& error, ...@@ -110,6 +110,15 @@ base::string16 GetShillErrorString(const std::string& error,
base::UTF8ToUTF16(error)); base::UTF8ToUTF16(error));
} }
bool IsConfigurationError(const std::string& error) {
if (error.empty())
return false;
return error == shill::kErrorPinMissing ||
error == shill::kErrorBadPassphrase ||
error == shill::kErrorResultInvalidPassphrase ||
error == shill::kErrorBadWEPKey;
}
} // namespace shill_error } // namespace shill_error
} // namespace chromeos } // namespace chromeos
...@@ -15,6 +15,9 @@ namespace shill_error { ...@@ -15,6 +15,9 @@ namespace shill_error {
base::string16 GetShillErrorString(const std::string& error, base::string16 GetShillErrorString(const std::string& error,
const std::string& network_id); const std::string& network_id);
// Returns true if |error| is known to be a configuration error.
bool IsConfigurationError(const std::string& error);
} // namespace shill_error } // namespace shill_error
} // namespace chromeos } // namespace chromeos
......
...@@ -478,7 +478,21 @@ void NetworkStateNotifier::ShowVpnDisconnectedNotification( ...@@ -478,7 +478,21 @@ void NetworkStateNotifier::ShowVpnDisconnectedNotification(
void NetworkStateNotifier::ShowNetworkSettings(const std::string& network_id) { void NetworkStateNotifier::ShowNetworkSettings(const std::string& network_id) {
if (!SystemTrayClient::Get()) if (!SystemTrayClient::Get())
return; return;
SystemTrayClient::Get()->ShowNetworkSettings(network_id); const NetworkState* network = GetNetworkStateForGuid(network_id);
if (!network)
return;
std::string error = network->GetErrorState();
if (!error.empty()) {
NET_LOG(ERROR) << "Notify ShowNetworkSettings: " << network_id
<< ": Error: " << error;
}
if (!NetworkTypePattern::Primitive(network->type())
.MatchesPattern(NetworkTypePattern::Mobile()) &&
shill_error::IsConfigurationError(error)) {
SystemTrayClient::Get()->ShowNetworkConfigure(network_id);
} else {
SystemTrayClient::Get()->ShowNetworkSettings(network_id);
}
} }
} // namespace chromeos } // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment