| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/signin/core/browser/fake_signin_manager.h" | 5 #include "components/signin/core/browser/fake_signin_manager.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "components/signin/core/browser/account_tracker_service.h" | 10 #include "components/signin/core/browser/account_tracker_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const std::string& refresh_token, | 35 const std::string& refresh_token, |
| 36 const std::string& gaia_id, | 36 const std::string& gaia_id, |
| 37 const std::string& username, | 37 const std::string& username, |
| 38 const std::string& password, | 38 const std::string& password, |
| 39 const OAuthTokenFetchedCallback& oauth_fetched_callback) { | 39 const OAuthTokenFetchedCallback& oauth_fetched_callback) { |
| 40 set_auth_in_progress( | 40 set_auth_in_progress( |
| 41 account_tracker_service()->SeedAccountInfo(gaia_id, username)); | 41 account_tracker_service()->SeedAccountInfo(gaia_id, username)); |
| 42 set_password(password); | 42 set_password(password); |
| 43 username_ = username; | 43 username_ = username; |
| 44 | 44 |
| 45 PrepareForSignin(SIGNIN_TYPE_WITH_REFRESH_TOKEN, gaia_id, username, password); |
| 46 |
| 45 if (!oauth_fetched_callback.is_null()) | 47 if (!oauth_fetched_callback.is_null()) |
| 46 oauth_fetched_callback.Run(refresh_token); | 48 oauth_fetched_callback.Run(refresh_token); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void FakeSigninManager::CompletePendingSignin() { | 51 void FakeSigninManager::CompletePendingSignin() { |
| 50 SetAuthenticatedAccountId(GetAccountIdForAuthInProgress()); | 52 SetAuthenticatedAccountId(GetAccountIdForAuthInProgress()); |
| 51 set_auth_in_progress(std::string()); | 53 set_auth_in_progress(std::string()); |
| 52 FOR_EACH_OBSERVER( | 54 FOR_EACH_OBSERVER( |
| 53 SigninManagerBase::Observer, observer_list_, | 55 SigninManagerBase::Observer, observer_list_, |
| 54 GoogleSigninSucceeded(authenticated_account_id_, username_, password_)); | 56 GoogleSigninSucceeded(authenticated_account_id_, username_, password_)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 set_password(std::string()); | 82 set_password(std::string()); |
| 81 const std::string account_id = GetAuthenticatedAccountId(); | 83 const std::string account_id = GetAuthenticatedAccountId(); |
| 82 const std::string username = GetAuthenticatedAccountInfo().email; | 84 const std::string username = GetAuthenticatedAccountInfo().email; |
| 83 authenticated_account_id_.clear(); | 85 authenticated_account_id_.clear(); |
| 84 | 86 |
| 85 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, | 87 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, |
| 86 GoogleSignedOut(account_id, username)); | 88 GoogleSignedOut(account_id, username)); |
| 87 } | 89 } |
| 88 | 90 |
| 89 #endif // !defined (OS_CHROMEOS) | 91 #endif // !defined (OS_CHROMEOS) |
| OLD | NEW |