| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 access_token_.clear(); | 71 access_token_.clear(); |
| 72 gaia_token_.clear(); | 72 gaia_token_.clear(); |
| 73 StartFetchingOAuthLoginAccessToken(profile); | 73 StartFetchingOAuthLoginAccessToken(profile); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void OAuth2LoginVerifier::StartFetchingOAuthLoginAccessToken(Profile* profile) { | 76 void OAuth2LoginVerifier::StartFetchingOAuthLoginAccessToken(Profile* profile) { |
| 77 OAuth2TokenService::ScopeSet scopes; | 77 OAuth2TokenService::ScopeSet scopes; |
| 78 scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope()); | 78 scopes.insert(GaiaUrls::GetInstance()->oauth1_login_scope()); |
| 79 login_token_request_ = ProfileOAuth2TokenServiceFactory:: | 79 ProfileOAuth2TokenService* token_service = |
| 80 GetForProfile(profile)->StartRequestWithContext( | 80 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 81 system_request_context_.get(), scopes, this); | 81 login_token_request_ = token_service->StartRequestWithContext( |
| 82 token_service->GetPrimaryAccountId(), |
| 83 system_request_context_.get(), |
| 84 scopes, |
| 85 this); |
| 82 } | 86 } |
| 83 | 87 |
| 84 void OAuth2LoginVerifier::StartOAuthLoginForUberToken() { | 88 void OAuth2LoginVerifier::StartOAuthLoginForUberToken() { |
| 85 // No service will fetch us uber auth token. | 89 // No service will fetch us uber auth token. |
| 86 gaia_system_fetcher_.reset( | 90 gaia_system_fetcher_.reset( |
| 87 new GaiaAuthFetcher(this, | 91 new GaiaAuthFetcher(this, |
| 88 std::string(GaiaConstants::kChromeOSSource), | 92 std::string(GaiaConstants::kChromeOSSource), |
| 89 system_request_context_.get())); | 93 system_request_context_.get())); |
| 90 gaia_system_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); | 94 gaia_system_fetcher_->StartTokenFetchForUberAuthExchange(access_token_); |
| 91 } | 95 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 LOG(ERROR) << "Unrecoverable error or retry count max reached for " | 227 LOG(ERROR) << "Unrecoverable error or retry count max reached for " |
| 224 << operation_id; | 228 << operation_id; |
| 225 UMA_HISTOGRAM_ENUMERATION( | 229 UMA_HISTOGRAM_ENUMERATION( |
| 226 base::StringPrintf("OAuth2Login.%sFailure", operation_id), | 230 base::StringPrintf("OAuth2Login.%sFailure", operation_id), |
| 227 error.state(), | 231 error.state(), |
| 228 GoogleServiceAuthError::NUM_STATES); | 232 GoogleServiceAuthError::NUM_STATES); |
| 229 error_handler.Run(); | 233 error_handler.Run(); |
| 230 } | 234 } |
| 231 | 235 |
| 232 } // namespace chromeos | 236 } // namespace chromeos |
| OLD | NEW |