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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_FAILED); | 213 SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_FAILED); |
214 } | 214 } |
215 | 215 |
216 void OAuth2LoginManager::FetchOAuth2Tokens() { | 216 void OAuth2LoginManager::FetchOAuth2Tokens() { |
217 DCHECK(auth_request_context_.get()); | 217 DCHECK(auth_request_context_.get()); |
218 // If we have authenticated cookie jar, get OAuth1 token first, then fetch | 218 // If we have authenticated cookie jar, get OAuth1 token first, then fetch |
219 // SID/LSID cookies through OAuthLogin call. | 219 // SID/LSID cookies through OAuthLogin call. |
220 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { | 220 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) { |
221 oauth2_token_fetcher_.reset( | 221 oauth2_token_fetcher_.reset( |
222 new OAuth2TokenFetcher(this, auth_request_context_.get())); | 222 new OAuth2TokenFetcher(this, auth_request_context_.get())); |
223 oauth2_token_fetcher_->StartExchangeFromCookies(); | 223 oauth2_token_fetcher_->StartExchangeFromCookies(""); |
224 } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { | 224 } else if (restore_strategy_ == RESTORE_FROM_AUTH_CODE) { |
225 DCHECK(!auth_code_.empty()); | 225 DCHECK(!auth_code_.empty()); |
226 oauth2_token_fetcher_.reset( | 226 oauth2_token_fetcher_.reset( |
227 new OAuth2TokenFetcher(this, | 227 new OAuth2TokenFetcher(this, |
228 g_browser_process->system_request_context())); | 228 g_browser_process->system_request_context())); |
229 oauth2_token_fetcher_->StartExchangeFromAuthCode(auth_code_); | 229 oauth2_token_fetcher_->StartExchangeFromAuthCode(auth_code_); |
230 } else { | 230 } else { |
231 NOTREACHED(); | 231 NOTREACHED(); |
232 SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_FAILED); | 232 SetSessionRestoreState(OAuth2LoginManager::SESSION_RESTORE_FAILED); |
233 } | 233 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 FOR_EACH_OBSERVER(Observer, observer_list_, | 394 FOR_EACH_OBSERVER(Observer, observer_list_, |
395 OnSessionRestoreStateChanged(user_profile_, state_)); | 395 OnSessionRestoreStateChanged(user_profile_, state_)); |
396 } | 396 } |
397 | 397 |
398 void OAuth2LoginManager::SetSessionRestoreStartForTesting( | 398 void OAuth2LoginManager::SetSessionRestoreStartForTesting( |
399 const base::Time& time) { | 399 const base::Time& time) { |
400 session_restore_start_ = time; | 400 session_restore_start_ = time; |
401 } | 401 } |
402 | 402 |
403 } // namespace chromeos | 403 } // namespace chromeos |
OLD | NEW |