#include "chrome/browser/ui/views/profiles/profile_management_step_controller.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/delete_profile_helper.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service_factory.h"
#include "chrome/browser/ui/profiles/profile_customization_util.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/profiles/profile_management_types.h"
#include "chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.h"
#include "chrome/browser/ui/views/profiles/profile_picker_web_contents_host.h"
#include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_utils.h"
#include "google_apis/gaia/core_account_id.h"
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
#include "chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.h"
#endif
namespace {
class ProfilePickerAppStepController : public ProfileManagementStepController { … };
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
class DiceSignInStepController : public ProfileManagementStepController { … };
class FinishSamlSignInStepController : public ProfileManagementStepController { … };
#endif
class PostSignInStepController : public ProfileManagementStepController { … };
class FinishFlowAndRunInBrowserStepController
: public ProfileManagementStepController { … };
class SearchEngineChoiceStepController
: public ProfileManagementStepController { … };
}
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForProfilePickerApp(
ProfilePickerWebContentsHost* host,
const GURL& initial_url) { … }
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForDiceSignIn(
ProfilePickerWebContentsHost* host,
std::unique_ptr<ProfilePickerDiceSignInProvider> dice_sign_in_provider,
DiceSignInStepFinishedCallback signed_in_callback) { … }
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForFinishSamlSignIn(
ProfilePickerWebContentsHost* host,
Profile* profile,
std::unique_ptr<content::WebContents> contents,
base::OnceCallback<void(PostHostClearedCallback)>
finish_picker_section_callback) { … }
#endif
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForPostSignInFlow(
ProfilePickerWebContentsHost* host,
std::unique_ptr<ProfilePickerSignedInFlowController> signed_in_flow) { … }
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForSearchEngineChoice(
ProfilePickerWebContentsHost* host,
SearchEngineChoiceDialogService* search_engine_choice_dialog_service,
content::WebContents* web_contents,
SearchEngineChoiceDialogService::EntryPoint entry_point,
base::OnceCallback<void(StepSwitchFinishedCallback)> callback) { … }
std::unique_ptr<ProfileManagementStepController>
ProfileManagementStepController::CreateForFinishFlowAndRunInBrowser(
ProfilePickerWebContentsHost* host,
base::OnceClosure finish_flow_and_run_in_browser_callback) { … }
ProfileManagementStepController::ProfileManagementStepController(
ProfilePickerWebContentsHost* host)
: … { … }
ProfileManagementStepController::~ProfileManagementStepController() = default;
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
void ProfileManagementStepController::OnReloadRequested() { … }
#endif
void ProfileManagementStepController::NavigateBackInternal(
content::WebContents* contents) { … }
bool ProfileManagementStepController::CanPopStep() const { … }