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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 kOAuth1Secret, "", user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 47 kOAuth1Secret, "", user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
48 } | 48 } |
49 | 49 |
50 void OAuth2LoginManager::RestoreSession( | 50 void OAuth2LoginManager::RestoreSession( |
51 Profile* user_profile, | 51 Profile* user_profile, |
52 net::URLRequestContextGetter* auth_request_context, | 52 net::URLRequestContextGetter* auth_request_context, |
53 SessionRestoreStrategy restore_strategy, | 53 SessionRestoreStrategy restore_strategy, |
54 const std::string& oauth2_refresh_token, | 54 const std::string& oauth2_refresh_token, |
55 const std::string& auth_code) { | 55 const std::string& auth_code) { |
56 // TODO(nkostylev): OAuth2LoginManager should support multi-profiles or | 56 // TODO(nkostylev): OAuth2LoginManager should support multi-profiles or |
57 // should be refactored as ProfileKeyedService. For now we unsubscribe from | 57 // should be refactored as BrowserContextKeyedService. For now we unsubscribe |
58 // TokenService notifications of a user that was previously active. | 58 // from TokenService notifications of a user that was previously active. |
59 // http://crbug.com/230342 | 59 // http://crbug.com/230342 |
60 registrar_.RemoveAll(); | 60 registrar_.RemoveAll(); |
61 user_profile_ = user_profile; | 61 user_profile_ = user_profile; |
62 auth_request_context_ = auth_request_context; | 62 auth_request_context_ = auth_request_context; |
63 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; | 63 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; |
64 restore_strategy_ = restore_strategy; | 64 restore_strategy_ = restore_strategy; |
65 refresh_token_ = oauth2_refresh_token; | 65 refresh_token_ = oauth2_refresh_token; |
66 auth_code_ = auth_code; | 66 auth_code_ = auth_code; |
67 | 67 |
68 // TODO(nkostylev): drop the previous fetchers if RestoreSession() is invoked | 68 // TODO(nkostylev): drop the previous fetchers if RestoreSession() is invoked |
(...skipping 201 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 |