Skip to content

Commit

Permalink
[Lacros] Implement unrecoverable Sync error action
Browse files Browse the repository at this point in the history
Click on the "Sign in again" button will disable and re-enable sync.

Bug: 1260291
Change-Id: Id26c6370fdba6b32d81d992d575beab865561f19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3602723
Auto-Submit: Alex Ilin <alexilin@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#998845}
  • Loading branch information
Alex Ilin authored and Chromium LUCI CQ committed May 3, 2022
1 parent ca19700 commit c728963
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions chrome/browser/ui/views/profiles/profile_menu_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,23 @@ void ProfileMenuView::OnSyncErrorButtonClicked(AvatarSyncErrorType error) {
case AvatarSyncErrorType::kManagedUserUnrecoverableError:
chrome::ShowSettingsSubPage(browser(), chrome::kSignOutSubPage);
break;
case AvatarSyncErrorType::kUnrecoverableError:
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
IdentityManagerFactory::GetForProfile(browser()->profile())
->GetPrimaryAccountMutator()
->RevokeSyncConsent(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS,
signin_metrics::SignoutDelete::kIgnoreMetric);
case AvatarSyncErrorType::kUnrecoverableError: {
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(browser()->profile());
// This error means that the Sync engine failed to initialize. Shutdown
// Sync engine by revoking sync consent.
identity_manager->GetPrimaryAccountMutator()->RevokeSyncConsent(
signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS,
signin_metrics::SignoutDelete::kIgnoreMetric);
Hide();
browser()->signin_view_controller()->ShowSignin(
profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN,
// Re-enable sync with the same primary account.
signin_ui_util::EnableSyncFromSingleAccountPromo(
browser(),
identity_manager->GetPrimaryAccountInfo(
signin::ConsentLevel::kSignin),
signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN);
#else
// TODO(https://crbug.com/1260291): Add support for Lacros.
NOTIMPLEMENTED();
#endif
break;
}
case AvatarSyncErrorType::kAuthError:
Hide();
signin_ui_util::ShowReauthForPrimaryAccountWithAuthError(
Expand Down

0 comments on commit c728963

Please sign in to comment.