Chromium Code Reviews| Index: chrome/browser/chromeos/login/login_utils.cc |
| diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc |
| index 94920bea0a9f6520df1be8aab500f8150a883846..e8302e3d9e66d20505e1f078f999238cb7e93ff8 100644 |
| --- a/chrome/browser/chromeos/login/login_utils.cc |
| +++ b/chrome/browser/chromeos/login/login_utils.cc |
| @@ -534,11 +534,12 @@ class JobRestartRequest |
| base::OneShotTimer<JobRestartRequest> timer_; |
| }; |
| -class LoginUtilsImpl : public LoginUtils, |
| - public GaiaOAuthConsumer, |
| - public OAuthLoginVerifier::Delegate, |
| - public net::NetworkChangeNotifier::OnlineStateObserver, |
| - public base::SupportsWeakPtr<LoginUtilsImpl> { |
| +class LoginUtilsImpl |
| + : public LoginUtils, |
| + public GaiaOAuthConsumer, |
| + public OAuthLoginVerifier::Delegate, |
| + public net::NetworkChangeNotifier::ConnectionTypeObserver, |
| + public base::SupportsWeakPtr<LoginUtilsImpl> { |
| public: |
| LoginUtilsImpl() |
| : pending_requests_(false), |
| @@ -547,11 +548,11 @@ class LoginUtilsImpl : public LoginUtils, |
| delegate_(NULL), |
| job_restart_request_(NULL), |
| should_restore_auth_session_(false) { |
| - net::NetworkChangeNotifier::AddOnlineStateObserver(this); |
| + net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| } |
| virtual ~LoginUtilsImpl() { |
| - net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); |
| + net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| } |
| // LoginUtils implementation: |
| @@ -598,8 +599,9 @@ class LoginUtilsImpl : public LoginUtils, |
| const std::string& auth) OVERRIDE; |
| virtual void OnOAuthVerificationFailed(const std::string& user_name) OVERRIDE; |
| - // net::NetworkChangeNotifier::OnlineStateObserver overrides. |
| - virtual void OnOnlineStateChanged(bool online) OVERRIDE; |
| + // net::NetworkChangeNotifier::ConnectionTypeObserver overrides. |
| + virtual void OnConnectionTypeChanged( |
| + net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| // Given the authenticated credentials from the cookie jar, try to exchange |
| // fetch OAuth request, v1 and v2 tokens. |
| @@ -1230,13 +1232,14 @@ void LoginUtilsImpl::RestoreAuthenticationSession(Profile* user_profile) { |
| return; |
| } |
| - if (!net::NetworkChangeNotifier::IsOffline()) { |
| + if (net::NetworkChangeNotifier::GetConnectionType() != |
| + net::NetworkChangeNotifier::CONNECTION_NONE) { |
|
wtc
2012/05/11 01:35:05
Nit: this line doesn't need to be indented.
|
| should_restore_auth_session_ = false; |
| KickStartAuthentication(user_profile); |
| } else { |
| - // Even if we're online we should wait till initial OnOnlineStateChanged() |
| - // call. Otherwise starting fetchers too early may end up cancelling |
| - // all request when initial network state is processed. |
| + // Even if we're online we should wait till initial |
| + // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may |
| + // end up cancelling all request when initial network state is processed. |
|
wtc
2012/05/11 01:35:05
initial network state => initial network connectio
|
| // See http://crbug.com/121643. |
| should_restore_auth_session_ = true; |
| } |
| @@ -1425,8 +1428,10 @@ void LoginUtilsImpl::OnOAuthVerificationSucceeded( |
| } |
| -void LoginUtilsImpl::OnOnlineStateChanged(bool online) { |
| - if (online && UserManager::Get()->IsUserLoggedIn()) { |
| +void LoginUtilsImpl::OnConnectionTypeChanged( |
| + net::NetworkChangeNotifier::ConnectionType type) { |
| + if (type != net::NetworkChangeNotifier::CONNECTION_NONE && |
| + UserManager::Get()->IsUserLoggedIn()) { |
| if (oauth_login_verifier_.get() && |
| !oauth_login_verifier_->is_done()) { |
| // If we come online for the first time after successful offline login, |