| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/oauth2_login_verifier.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_verifier.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 new GaiaAuthFetcher(this, | 160 new GaiaAuthFetcher(this, |
| 161 std::string(GaiaConstants::kChromeOSSource), | 161 std::string(GaiaConstants::kChromeOSSource), |
| 162 user_request_context_.get())); | 162 user_request_context_.get())); |
| 163 gaia_fetcher_->StartMergeSession(gaia_token_); | 163 gaia_fetcher_->StartMergeSession(gaia_token_); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void OAuth2LoginVerifier::OnMergeSessionSuccess(const std::string& data) { | 166 void OAuth2LoginVerifier::OnMergeSessionSuccess(const std::string& data) { |
| 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 168 LOG(INFO) << "MergeSession successful."; | 168 LOG(INFO) << "MergeSession successful."; |
| 169 delegate_->OnSessionMergeSuccess(); | 169 delegate_->OnSessionMergeSuccess(); |
| 170 // Get GAIA credentials needed to kick off TokenService and friends. | 170 // Get GAIA credentials needed to kick off OAuth2TokenService and friends. |
| 171 StartOAuthLoginForGaiaCredentials(); | 171 StartOAuthLoginForGaiaCredentials(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void OAuth2LoginVerifier::OnMergeSessionFailure( | 174 void OAuth2LoginVerifier::OnMergeSessionFailure( |
| 175 const GoogleServiceAuthError& error) { | 175 const GoogleServiceAuthError& error) { |
| 176 LOG(WARNING) << "Failed MergeSession request," | 176 LOG(WARNING) << "Failed MergeSession request," |
| 177 << " error: " << error.state(); | 177 << " error: " << error.state(); |
| 178 // If MergeSession from GAIA service token fails, retry the session restore | 178 // If MergeSession from GAIA service token fails, retry the session restore |
| 179 // from OAuth2 refresh token. If that failed too, signal the delegate. | 179 // from OAuth2 refresh token. If that failed too, signal the delegate. |
| 180 RetryOnError( | 180 RetryOnError( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 << operation_id; | 236 << operation_id; |
| 237 UMA_HISTOGRAM_ENUMERATION( | 237 UMA_HISTOGRAM_ENUMERATION( |
| 238 base::StringPrintf("OAuth2Login.%sFailure", operation_id), | 238 base::StringPrintf("OAuth2Login.%sFailure", operation_id), |
| 239 error.state(), | 239 error.state(), |
| 240 GoogleServiceAuthError::NUM_STATES); | 240 GoogleServiceAuthError::NUM_STATES); |
| 241 | 241 |
| 242 error_handler.Run(IsConnectionOrServiceError(error)); | 242 error_handler.Run(IsConnectionOrServiceError(error)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace chromeos | 245 } // namespace chromeos |
| OLD | NEW |