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_manager.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 token_service->Initialize(GaiaConstants::kChromeSource, user_profile_); | 134 token_service->Initialize(GaiaConstants::kChromeSource, user_profile_); |
135 token_service->LoadTokensFromDB(); | 135 token_service->LoadTokensFromDB(); |
136 } | 136 } |
137 | 137 |
138 void OAuth2LoginManager::FetchOAuth2Tokens() { | 138 void OAuth2LoginManager::FetchOAuth2Tokens() { |
139 DCHECK(auth_request_context_.get()); | 139 DCHECK(auth_request_context_.get()); |
140 // If we have authenticated cookie jar, get OAuth1 token first, then fetch | 140 // If we have authenticated cookie jar, get OAuth1 token first, then fetch |
141 // SID/LSID cookies through OAuthLogin call. | 141 // SID/LSID cookies through OAuthLogin call. |
142 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { | 142 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { |
143 oauth2_token_fetcher_.reset( | 143 oauth2_token_fetcher_.reset( |
144 new OAuth2TokenFetcher(this, auth_request_context_)); | 144 new OAuth2TokenFetcher(this, auth_request_context_.get())); |
145 oauth2_token_fetcher_->StartExchangeFromCookies(); | 145 oauth2_token_fetcher_->StartExchangeFromCookies(); |
146 } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { | 146 } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { |
147 DCHECK(!auth_code_.empty()); | 147 DCHECK(!auth_code_.empty()); |
148 oauth2_token_fetcher_.reset( | 148 oauth2_token_fetcher_.reset( |
149 new OAuth2TokenFetcher(this, | 149 new OAuth2TokenFetcher(this, |
150 g_browser_process->system_request_context())); | 150 g_browser_process->system_request_context())); |
151 oauth2_token_fetcher_->StartExchangeFromAuthCode(auth_code_); | 151 oauth2_token_fetcher_->StartExchangeFromAuthCode(auth_code_); |
152 } else { | 152 } else { |
153 NOTREACHED(); | 153 NOTREACHED(); |
154 } | 154 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 void OAuth2LoginManager::StartTokenService( | 272 void OAuth2LoginManager::StartTokenService( |
273 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { | 273 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { |
274 TokenService* token_service = SetupTokenService(); | 274 TokenService* token_service = SetupTokenService(); |
275 token_service->UpdateCredentials(gaia_credentials); | 275 token_service->UpdateCredentials(gaia_credentials); |
276 CompleteAuthentication(); | 276 CompleteAuthentication(); |
277 } | 277 } |
278 | 278 |
279 } // namespace chromeos | 279 } // namespace chromeos |
OLD | NEW |