#include "chrome/browser/ui/views/profiles/first_run_flow_controller_dice.h"
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/util/managed_browser_utils.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.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/signin/identity_manager_factory.h"
#include "chrome/browser/ui/views/profiles/profile_management_flow_controller.h"
#include "chrome/browser/ui/views/profiles/profile_management_flow_controller_impl.h"
#include "chrome/browser/ui/views/profiles/profile_management_step_controller.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/intro/intro_ui.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "content/public/browser/web_ui.h"
#include "google_apis/gaia/core_account_id.h"
#include "url/gurl.h"
namespace {
constexpr base::TimeDelta kDefaultBrowserCheckTimeout = …;
const signin_metrics::AccessPoint kAccessPoint = …;
enum class ShowDefaultBrowserStep { … };
bool IsDefaultBrowserDisabledByPolicy() { … }
void MaybeLogSetAsDefaultSuccess(
shell_integration::DefaultWebClientState state) { … }
bool IsPostIdentityStep(ProfileManagementFlowController::Step step) { … }
class IntroStepController : public ProfileManagementStepController { … };
class DefaultBrowserStepController : public ProfileManagementStepController { … };
IdentityStepsCompletedCallback;
class FirstRunPostSignInAdapter : public ProfilePickerSignedInFlowController { … };
}
std::unique_ptr<ProfileManagementStepController> CreateIntroStep(
ProfilePickerWebContentsHost* host,
base::RepeatingCallback<void(IntroChoice)> choice_callback,
bool enable_animations) { … }
FirstRunFlowControllerDice::FirstRunFlowControllerDice(
ProfilePickerWebContentsHost* host,
ClearHostClosure clear_host_callback,
Profile* profile,
ProfilePicker::FirstRunExitedCallback first_run_exited_callback)
: … { … }
FirstRunFlowControllerDice::~FirstRunFlowControllerDice() { … }
void FirstRunFlowControllerDice::Init(
StepSwitchFinishedCallback step_switch_finished_callback) { … }
void FirstRunFlowControllerDice::CancelPostSignInFlow() { … }
bool FirstRunFlowControllerDice::PreFinishWithBrowser() { … }
void FirstRunFlowControllerDice::HandleIntroSigninChoice(IntroChoice choice) { … }
std::unique_ptr<ProfilePickerSignedInFlowController>
FirstRunFlowControllerDice::CreateSignedInFlowController(
Profile* signed_in_profile,
const CoreAccountInfo& account_info,
std::unique_ptr<content::WebContents> contents) { … }
void FirstRunFlowControllerDice::RunFinishFlowCallback() { … }
base::queue<ProfileManagementFlowController::Step>
FirstRunFlowControllerDice::RegisterPostIdentitySteps(
PostHostClearedCallback post_host_cleared_callback) { … }