Commit 6f436bae authored by David Roger's avatar David Roger Committed by Commit Bot

[signin] AccountReconcilorFactory uses the per-profile account consistency

The AccountReconcilorFactory was using the value from the Finch config
experiment instead of the per-profile value. This can lead to bugs when
these differ, which happens in particular when the client ID is not set.

Bug: 777774
Change-Id: I5c67ab704be119770d919a0ce3b8a623809ef0f2
Reviewed-on: https://chromium-review.googlesource.com/1097128
Commit-Queue: David Roger <droger@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566808}
parent e20ce45a
......@@ -105,36 +105,32 @@ KeyedService* AccountReconcilorFactory::BuildServiceInstanceFor(
// static
std::unique_ptr<signin::AccountReconcilorDelegate>
AccountReconcilorFactory::CreateAccountReconcilorDelegate(Profile* profile) {
if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile)) {
signin::AccountConsistencyMethod account_consistency =
AccountConsistencyModeManager::GetMethodForProfile(profile);
switch (account_consistency) {
case signin::AccountConsistencyMethod::kMirror:
#if defined(OS_CHROMEOS)
// Only for child accounts on Chrome OS, use the specialized Mirror
// delegate.
if (profile->IsChild()) {
return std::make_unique<ChromeOSChildAccountReconcilorDelegate>(
SigninManagerFactory::GetForProfile(profile));
}
// Only for child accounts on Chrome OS, use the specialized Mirror
// delegate.
if (profile->IsChild()) {
return std::make_unique<ChromeOSChildAccountReconcilorDelegate>(
SigninManagerFactory::GetForProfile(profile));
}
#endif
return std::make_unique<signin::MirrorAccountReconcilorDelegate>(
SigninManagerFactory::GetForProfile(profile));
}
// TODO(droger): Remove this switch case. |AccountConsistencyModeManager| is
// the source of truth.
switch (signin::GetAccountConsistencyMethod()) {
case signin::AccountConsistencyMethod::kMirror:
// It is not possible for |IsMirrorEnabledForProfile| to return false,
// and this case being true.
NOTREACHED();
return nullptr;
return std::make_unique<signin::MirrorAccountReconcilorDelegate>(
SigninManagerFactory::GetForProfile(profile));
case signin::AccountConsistencyMethod::kDisabled:
case signin::AccountConsistencyMethod::kDiceFixAuthErrors:
return std::make_unique<signin::AccountReconcilorDelegate>();
case signin::AccountConsistencyMethod::kDicePrepareMigration:
case signin::AccountConsistencyMethod::kDiceMigration:
case signin::AccountConsistencyMethod::kDice:
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
return std::make_unique<signin::DiceAccountReconcilorDelegate>(
ChromeSigninClientFactory::GetForProfile(profile),
AccountConsistencyModeManager::GetMethodForProfile(profile));
account_consistency);
#else
NOTREACHED();
return nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment