#include "chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h"
#include <optional>
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/enterprise/util/managed_browser_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_util.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#include "chrome/browser/ui/views/profiles/profile_management_types.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/browser/ui/webui/signin/signin_ui_error.h"
#include "chrome/browser/ui/webui/signin/signin_utils.h"
#include "chrome/common/webui_url_constants.h"
#include "components/signin/public/base/signin_switches.h"
namespace {
std::optional<ProfileMetrics::ProfileSignedInFlowOutcome> GetSyncOutcome(
bool enterprise_account,
bool sync_disabled,
LoginUIService::SyncConfirmationUIClosedResult result) { … }
void OpenSettingsInBrowser(Browser* browser) { … }
bool IsLacrosPrimaryProfileFirstRun(Profile* profile) { … }
}
ProfilePickerTurnSyncOnDelegate::ProfilePickerTurnSyncOnDelegate(
base::WeakPtr<ProfilePickerSignedInFlowController> controller,
Profile* profile)
: … { … }
ProfilePickerTurnSyncOnDelegate::~ProfilePickerTurnSyncOnDelegate() = default;
void ProfilePickerTurnSyncOnDelegate::ShowLoginError(
const SigninUIError& error) { … }
void ProfilePickerTurnSyncOnDelegate::ShowMergeSyncDataConfirmation(
const std::string& previous_email,
const std::string& new_email,
signin::SigninChoiceCallback callback) { … }
void ProfilePickerTurnSyncOnDelegate::ShowEnterpriseAccountConfirmation(
const AccountInfo& account_info,
signin::SigninChoiceCallback callback) { … }
void ProfilePickerTurnSyncOnDelegate::ShowSyncConfirmation(
base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)>
callback) { … }
bool ProfilePickerTurnSyncOnDelegate::
ShouldAbortBeforeShowSyncDisabledConfirmation() { … }
void ProfilePickerTurnSyncOnDelegate::ShowSyncDisabledConfirmation(
bool is_managed_account,
base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)>
callback) { … }
void ProfilePickerTurnSyncOnDelegate::ShowSyncSettings() { … }
void ProfilePickerTurnSyncOnDelegate::SwitchToProfile(Profile* new_profile) { … }
void ProfilePickerTurnSyncOnDelegate::OnSyncConfirmationUIClosed(
LoginUIService::SyncConfirmationUIClosedResult result) { … }
void ProfilePickerTurnSyncOnDelegate::ShowSyncConfirmationScreen() { … }
void ProfilePickerTurnSyncOnDelegate::FinishSyncConfirmation(
LoginUIService::SyncConfirmationUIClosedResult result) { … }
void ProfilePickerTurnSyncOnDelegate::ShowManagedUserNotice(
ManagedUserProfileNoticeUI::ScreenType type) { … }
void ProfilePickerTurnSyncOnDelegate::HandleCancelSigninChoice(
ProfileMetrics::ProfileSignedInFlowOutcome outcome) { … }
void ProfilePickerTurnSyncOnDelegate::OnManagedUserNoticeClosed(
ManagedUserProfileNoticeUI::ScreenType type,
signin::SigninChoice choice) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void ProfilePickerTurnSyncOnDelegate::OnLacrosIntroClosed(
signin::SigninChoice choice) {
if (choice == signin::SIGNIN_CHOICE_CANCEL) {
HandleCancelSigninChoice(ProfileMetrics::ProfileSignedInFlowOutcome::
kAbortedOnEnterpriseWelcome);
return;
}
ShowSyncConfirmationScreen();
}
#endif
void ProfilePickerTurnSyncOnDelegate::LogOutcome(
ProfileMetrics::ProfileSignedInFlowOutcome outcome) { … }