| 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/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 "", | 48 "", |
| 49 PrefRegistrySyncable::UNSYNCABLE_PREF); | 49 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void OAuth2LoginManager::RestoreSession( | 52 void OAuth2LoginManager::RestoreSession( |
| 53 Profile* user_profile, | 53 Profile* user_profile, |
| 54 net::URLRequestContextGetter* auth_request_context, | 54 net::URLRequestContextGetter* auth_request_context, |
| 55 SessionRestoreStrategy restore_strategy, | 55 SessionRestoreStrategy restore_strategy, |
| 56 const std::string& oauth2_refresh_token, | 56 const std::string& oauth2_refresh_token, |
| 57 const std::string& auth_code) { | 57 const std::string& auth_code) { |
| 58 // TODO(nkostylev): OAuth2LoginManager should support multi-profiles or |
| 59 // should be refactored as ProfileKeyedService. For now we unsubscribe from |
| 60 // TokenService notifications of a user that was previously active. |
| 61 // http://crbug.com/230342 |
| 62 registrar_.RemoveAll(); |
| 58 user_profile_ = user_profile; | 63 user_profile_ = user_profile; |
| 59 auth_request_context_ = auth_request_context; | 64 auth_request_context_ = auth_request_context; |
| 60 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; | 65 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; |
| 61 restore_strategy_ = restore_strategy; | 66 restore_strategy_ = restore_strategy; |
| 62 refresh_token_ = oauth2_refresh_token; | 67 refresh_token_ = oauth2_refresh_token; |
| 63 auth_code_ = auth_code; | 68 auth_code_ = auth_code; |
| 64 | 69 |
| 65 // TODO(zelidrag): Remove eventually the next line in some future milestone. | 70 // TODO(zelidrag): Remove eventually the next line in some future milestone. |
| 66 RemoveLegacyTokens(); | 71 RemoveLegacyTokens(); |
| 67 | 72 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 298 } |
| 294 | 299 |
| 295 void OAuth2LoginManager::StartTokenService( | 300 void OAuth2LoginManager::StartTokenService( |
| 296 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { | 301 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { |
| 297 TokenService* token_service = SetupTokenService(); | 302 TokenService* token_service = SetupTokenService(); |
| 298 token_service->UpdateCredentials(gaia_credentials); | 303 token_service->UpdateCredentials(gaia_credentials); |
| 299 CompleteAuthentication(); | 304 CompleteAuthentication(); |
| 300 } | 305 } |
| 301 | 306 |
| 302 } // namespace chromeos | 307 } // namespace chromeos |
| OLD | NEW |