Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4310)

Unified Diff: chrome/browser/signin/fake_signin_manager.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/fake_signin_manager.cc
diff --git a/chrome/browser/signin/fake_signin_manager.cc b/chrome/browser/signin/fake_signin_manager.cc
index 8314079fe8a782ece0255bf33191d0bd7b3ca5d0..6cc2902ae03f0233cbf56a2fcb8b1d46d9a44612 100644
--- a/chrome/browser/signin/fake_signin_manager.cc
+++ b/chrome/browser/signin/fake_signin_manager.cc
@@ -14,10 +14,13 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
+#include "chrome/common/pref_names.h"
+#include "components/signin/core/browser/account_tracker_service.h"
FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile)
: SigninManagerBase(
- ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)) {}
+ ChromeSigninClientFactory::GetForProfile(profile),
+ AccountTrackerServiceFactory::GetForProfile(profile)) {}
FakeSigninManagerBase::~FakeSigninManagerBase() {
}
@@ -41,7 +44,7 @@ KeyedService* FakeSigninManagerBase::Build(content::BrowserContext* context) {
FakeSigninManager::FakeSigninManager(Profile* profile)
: SigninManager(
- ChromeSigninClientFactory::GetInstance()->GetForProfile(profile),
+ ChromeSigninClientFactory::GetForProfile(profile),
ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
AccountTrackerServiceFactory::GetForProfile(profile),
GaiaCookieManagerServiceFactory::GetForProfile(profile)) {}
@@ -51,30 +54,36 @@ FakeSigninManager::~FakeSigninManager() {
void FakeSigninManager::StartSignInWithRefreshToken(
const std::string& refresh_token,
+ const std::string& gaia_id,
const std::string& username,
const std::string& password,
const OAuthTokenFetchedCallback& oauth_fetched_callback) {
- set_auth_in_progress(username);
+ set_auth_in_progress(
+ account_tracker_service()->SeedAccountInfo(gaia_id, username));
set_password(password);
+ username_ = username;
+
if (!oauth_fetched_callback.is_null())
oauth_fetched_callback.Run(refresh_token);
}
void FakeSigninManager::CompletePendingSignin() {
- SetAuthenticatedUsername(GetUsernameForAuthInProgress());
+ SetAuthenticatedAccountId(GetAccountIdForAuthInProgress());
set_auth_in_progress(std::string());
FOR_EACH_OBSERVER(SigninManagerBase::Observer,
observer_list_,
- GoogleSigninSucceeded(authenticated_username_,
- authenticated_username_,
+ GoogleSigninSucceeded(authenticated_account_id_,
+ username_,
password_));
}
-void FakeSigninManager::SignIn(const std::string& username,
+void FakeSigninManager::SignIn(const std::string& gaia_id,
+ const std::string& username,
const std::string& password) {
StartSignInWithRefreshToken(
- std::string(), username, password, OAuthTokenFetchedCallback());
+ std::string(), gaia_id, username, password,
+ OAuthTokenFetchedCallback());
CompletePendingSignin();
}
@@ -92,7 +101,7 @@ void FakeSigninManager::SignOut(
set_password(std::string());
const std::string account_id = GetAuthenticatedAccountId();
const std::string username = GetAuthenticatedUsername();
- ClearAuthenticatedUsername();
+ authenticated_account_id_.clear();
FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_,
GoogleSignedOut(account_id, username));

Powered by Google App Engine
This is Rietveld 408576698