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 registrar_.RemoveAll(); |
58 user_profile_ = user_profile; | 62 user_profile_ = user_profile; |
59 auth_request_context_ = auth_request_context; | 63 auth_request_context_ = auth_request_context; |
60 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; | 64 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; |
61 restore_strategy_ = restore_strategy; | 65 restore_strategy_ = restore_strategy; |
62 refresh_token_ = oauth2_refresh_token; | 66 refresh_token_ = oauth2_refresh_token; |
63 auth_code_ = auth_code; | 67 auth_code_ = auth_code; |
64 | 68 |
65 // TODO(zelidrag): Remove eventually the next line in some future milestone. | 69 // TODO(zelidrag): Remove eventually the next line in some future milestone. |
66 RemoveLegacyTokens(); | 70 RemoveLegacyTokens(); |
67 | 71 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 297 } |
294 | 298 |
295 void OAuth2LoginManager::StartTokenService( | 299 void OAuth2LoginManager::StartTokenService( |
296 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { | 300 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { |
297 TokenService* token_service = SetupTokenService(); | 301 TokenService* token_service = SetupTokenService(); |
298 token_service->UpdateCredentials(gaia_credentials); | 302 token_service->UpdateCredentials(gaia_credentials); |
299 CompleteAuthentication(); | 303 CompleteAuthentication(); |
300 } | 304 } |
301 | 305 |
302 } // namespace chromeos | 306 } // namespace chromeos |
OLD | NEW |