diff options
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 21 | ||||
-rw-r--r-- | chrome/browser/chromeos/network_message_observer.cc | 1 |
2 files changed, 16 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 7fa69fc..5ef8ef7 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -297,10 +297,8 @@ void Network::SetState(ConnectionState new_state) { ConnectionState old_state = state_; VLOG(2) << "Entering new state: " << ConnectionStateString(new_state); state_ = new_state; - if (!IsConnectingState(new_state)) - set_connection_started(false); if (new_state == STATE_FAILURE) { - VLOG(2) << "Detected Failure state."; + VLOG(1) << service_path() << ": Detected Failure state."; if (old_state != STATE_UNKNOWN && old_state != STATE_IDLE) { // New failure, the user needs to be notified. // Transition STATE_IDLE -> STATE_FAILURE sometimes happens on resume @@ -313,6 +311,13 @@ void Network::SetState(ConnectionState new_state) { error_ = ERROR_UNKNOWN; } } + } else if (new_state == STATE_IDLE && IsConnectingState(old_state) + && connection_started()) { + // If we requested a connect and never went through a connected state, + // treat it as a failure. + VLOG(1) << service_path() << ": Inferring Failure state."; + notify_failure_ = true; + error_ = ERROR_UNKNOWN; } else if (new_state != STATE_UNKNOWN) { notify_failure_ = false; // State changed, so refresh IP address. @@ -321,6 +326,8 @@ void Network::SetState(ConnectionState new_state) { } VLOG(1) << name() << ".State [" << service_path() << "]: " << GetStateString() << " (was: " << ConnectionStateString(old_state) << ")"; + if (!IsConnectingState(new_state) && new_state != STATE_UNKNOWN) + set_connection_started(false); } void Network::SetError(ConnectionError error) { @@ -1224,9 +1231,11 @@ std::string WifiNetwork::GetEncryptionString() const { } bool WifiNetwork::IsPassphraseRequired() const { - // TODO(stevenjb): Remove error_ tests when fixed. - // (http://crosbug.com/10135). - if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY) + if (encryption_ == SECURITY_NONE) + return false; + // A connection failure might be due to a bad passphrase. + if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY || + error() == ERROR_UNKNOWN) return true; // For 802.1x networks, configuration is required if connectable is false // unless we're using a certificate pattern. diff --git a/chrome/browser/chromeos/network_message_observer.cc b/chrome/browser/chromeos/network_message_observer.cc index c63cf39..da948f0 100644 --- a/chrome/browser/chromeos/network_message_observer.cc +++ b/chrome/browser/chromeos/network_message_observer.cc @@ -281,6 +281,7 @@ void NetworkMessageObserver::OnNetworkManagerChanged(NetworkLibrary* cros) { // Show connection error notification if necessary. if (new_failed_network) { + VLOG(1) << "Failed Network: " << new_failed_network->service_path(); notification_connection_error_->ShowAlways( l10n_util::GetStringFUTF16( IDS_NETWORK_CONNECTION_ERROR_MESSAGE_WITH_DETAILS, |