Commit 55a072c4 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Signin] Fix sign-out flow for unconsented primary account

Fixes two separate issues with the unconsented primary account sign-out
flow within PrimaryAccountMutator and PrimaryAccountManager:
1. Check HasUnconsentedPrimaryAccount in PrimaryAccountMutator so that
   the PrimaryAccountManager::SignOutXYZ is actually invoked even if
   there's no sync consent.
2. Make sure PrimaryAccountMutator calls GoogleSignedOut using a correct
   account info - before this change, it would be invoked with an empty
   account info if there's no sync consent.

Bug: 1130526
Change-Id: I9019faeb602a32a499ae7fd3cab09f5634fc69ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421739
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809317}
parent 1846e9ac
...@@ -351,9 +351,11 @@ void PrimaryAccountManager::OnSignoutDecisionReached( ...@@ -351,9 +351,11 @@ void PrimaryAccountManager::OnSignoutDecisionReached(
return; return;
} }
const CoreAccountInfo account_info = GetAuthenticatedAccountInfo(); const CoreAccountInfo account_info = primary_account_info();
client_->GetPrefs()->ClearPref(prefs::kGoogleServicesHostedDomain); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesHostedDomain);
SetPrimaryAccountInternal(account_info, /*consented_to_sync=*/false); // Revoke the sync consent.
if (IsAuthenticated())
SetPrimaryAccountInternal(account_info, /*consented_to_sync=*/false);
// Revoke all tokens before sending signed_out notification, because there // Revoke all tokens before sending signed_out notification, because there
// may be components that don't listen for token service events when the // may be components that don't listen for token service events when the
......
...@@ -78,7 +78,7 @@ bool PrimaryAccountMutatorImpl::ClearPrimaryAccount( ...@@ -78,7 +78,7 @@ bool PrimaryAccountMutatorImpl::ClearPrimaryAccount(
ClearAccountsAction action, ClearAccountsAction action,
signin_metrics::ProfileSignout source_metric, signin_metrics::ProfileSignout source_metric,
signin_metrics::SignoutDelete delete_metric) { signin_metrics::SignoutDelete delete_metric) {
if (!primary_account_manager_->IsAuthenticated()) if (!primary_account_manager_->HasUnconsentedPrimaryAccount())
return false; return false;
switch (action) { switch (action) {
......
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