From 5a0f11fa8b355fe0fc00c3dfc4f6c3f305702095 Mon Sep 17 00:00:00 2001 From: Yann Dago Date: Fri, 25 Mar 2022 23:25:39 +0000 Subject: [PATCH] Use SigninChoice for the enterprise welcome dialog Bug: 1275359 Change-Id: Ibeea6f996973d4fa02c831128b5d77eca44979c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3530729 Reviewed-by: David Roger Commit-Queue: Yann Dago Cr-Commit-Position: refs/heads/main@{#985553} --- .../dice_web_signin_interceptor_delegate.cc | 25 ++++++++++++++----- chrome/browser/ui/signin_view_controller.cc | 9 +++---- chrome/browser/ui/signin_view_controller.h | 3 ++- .../ui/signin_view_controller_delegate.h | 3 ++- ...gnin_view_controller_interactive_uitest.cc | 9 ++++--- ...rofile_picker_signed_in_flow_controller.cc | 4 +-- ...profile_picker_signed_in_flow_controller.h | 4 +-- .../profile_picker_turn_sync_on_delegate.cc | 6 +++-- .../profile_picker_turn_sync_on_delegate.h | 2 +- .../profile_picker_view_browsertest.cc | 13 +++++----- .../signin_view_controller_delegate_views.cc | 5 ++-- .../signin_view_controller_delegate_views.h | 3 ++- .../enterprise_profile_welcome_handler.cc | 10 ++++---- .../enterprise_profile_welcome_handler.h | 7 +++--- .../signin/enterprise_profile_welcome_ui.cc | 3 ++- .../signin/enterprise_profile_welcome_ui.h | 3 ++- .../turn_sync_on_helper_delegate_impl.cc | 14 ++++++----- 17 files changed, 73 insertions(+), 50 deletions(-) diff --git a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc index 744b4a3dc5c258..830640472b2713 100644 --- a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc +++ b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "google_apis/gaia/core_account_id.h" @@ -69,13 +70,25 @@ class ForcedEnterpriseSigninInterceptionHandle base::Unretained(this))); } - void OnEnterpriseInterceptionDialogClosed(bool create_profile) { - if (!create_profile) - browser_->signin_view_controller()->CloseModalSignin(); - std::move(callback_).Run(create_profile - ? SigninInterceptionResult::kAccepted - : SigninInterceptionResult::kDeclined); + void OnEnterpriseInterceptionDialogClosed(signin::SigninChoice choice) { + switch (choice) { + case signin::SIGNIN_CHOICE_NEW_PROFILE: + std::move(callback_).Run(SigninInterceptionResult::kAccepted); + break; + case signin::SIGNIN_CHOICE_CANCEL: + browser_->signin_view_controller()->CloseModalSignin(); + std::move(callback_).Run(SigninInterceptionResult::kDeclined); + break; + case signin::SIGNIN_CHOICE_CONTINUE: + // TODO (crbug/1275359): Add support for this once the "Link Data" + // checkbox is added to the interception dialog. + case signin::SIGNIN_CHOICE_SIZE: + default: + NOTREACHED(); + break; + } } + raw_ptr browser_; base::OnceCallback callback_; }; diff --git a/chrome/browser/ui/signin_view_controller.cc b/chrome/browser/ui/signin_view_controller.cc index da8579c43b74f3..5d7699b17d4b3e 100644 --- a/chrome/browser/ui/signin_view_controller.cc +++ b/chrome/browser/ui/signin_view_controller.cc @@ -20,6 +20,7 @@ #include "chrome/browser/ui/signin_modal_dialog.h" #include "chrome/browser/ui/signin_modal_dialog_impl.h" #include "chrome/browser/ui/signin_view_controller_delegate.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/base/consent_level.h" #include "components/signin/public/base/signin_buildflags.h" #include "components/signin/public/identity_manager/account_info.h" @@ -257,17 +258,13 @@ void SigninViewController::ShowModalSyncConfirmationDialog() { void SigninViewController::ShowModalEnterpriseConfirmationDialog( const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback) { + signin::SigninChoiceCallback callback) { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) CloseModalSignin(); dialog_ = std::make_unique( SigninViewControllerDelegate::CreateEnterpriseConfirmationDelegate( - browser_, account_info, profile_color, - base::BindOnce( - [](Browser* browser, base::OnceCallback callback, - bool result) { std::move(callback).Run(result); }, - base::Unretained(browser_), std::move(callback))), + browser_, account_info, profile_color, std::move(callback)), GetOnModalDialogClosedCallback()); chrome::RecordDialogCreation( chrome::DialogIdentifier::SIGNIN_ENTERPRISE_INTERCEPTION); diff --git a/chrome/browser/ui/signin_view_controller.h b/chrome/browser/ui/signin_view_controller.h index 3549238f4254ae..3c420455ee695f 100644 --- a/chrome/browser/ui/signin_view_controller.h +++ b/chrome/browser/ui/signin_view_controller.h @@ -14,6 +14,7 @@ #include "build/build_config.h" #include "chrome/browser/ui/profile_chooser_constants.h" #include "chrome/browser/ui/signin_modal_dialog.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/base/signin_buildflags.h" #include "third_party/skia/include/core/SkColor.h" #include "url/gurl.h" @@ -144,7 +145,7 @@ class SigninViewController { void ShowModalEnterpriseConfirmationDialog( const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback); + signin::SigninChoiceCallback callback); // Shows the modal sign-in error dialog as a browser-modal dialog on top of // the |browser_|'s window. diff --git a/chrome/browser/ui/signin_view_controller_delegate.h b/chrome/browser/ui/signin_view_controller_delegate.h index 38860ee7dbb5df..09ca037ab111b2 100644 --- a/chrome/browser/ui/signin_view_controller_delegate.h +++ b/chrome/browser/ui/signin_view_controller_delegate.h @@ -10,6 +10,7 @@ #include "base/observer_list_types.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/base/signin_buildflags.h" #include "third_party/skia/include/core/SkColor.h" @@ -82,7 +83,7 @@ class SigninViewControllerDelegate { Browser* browser, const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback); + signin::SigninChoiceCallback callback); #endif void AddObserver(Observer* observer); diff --git a/chrome/browser/ui/signin_view_controller_interactive_uitest.cc b/chrome/browser/ui/signin_view_controller_interactive_uitest.cc index c11a1bcd9c57dd..645c01779c9fb6 100644 --- a/chrome/browser/ui/signin_view_controller_interactive_uitest.cc +++ b/chrome/browser/ui/signin_view_controller_interactive_uitest.cc @@ -205,13 +205,14 @@ IN_PROC_BROWSER_TEST_F(SignInViewControllerBrowserTest, content::TestNavigationObserver content_observer( GURL("chrome://enterprise-profile-welcome/")); content_observer.StartWatchingNewWebContents(); - bool result; + signin::SigninChoice result; browser()->signin_view_controller()->ShowModalEnterpriseConfirmationDialog( account_info, SK_ColorWHITE, base::BindOnce( - [](Browser* browser, bool* result, bool create) { + [](Browser* browser, signin::SigninChoice* result, + signin::SigninChoice choice) { browser->signin_view_controller()->CloseModalSignin(); - *result = create; + *result = choice; }, browser(), &result)); EXPECT_TRUE(browser()->signin_view_controller()->ShowsModalDialog()); @@ -227,6 +228,6 @@ IN_PROC_BROWSER_TEST_F(SignInViewControllerBrowserTest, /*command=*/false)); dialog_destroyed_watcher.Wait(); - EXPECT_TRUE(result); + EXPECT_EQ(result, signin::SigninChoice::SIGNIN_CHOICE_NEW_PROFILE); EXPECT_FALSE(browser()->signin_view_controller()->ShowsModalDialog()); } diff --git a/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.cc b/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.cc index 69beea1551b491..8b2fa2267006d5 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.cc @@ -78,7 +78,7 @@ void ProfilePickerSignedInFlowController::SwitchToSyncConfirmation() { void ProfilePickerSignedInFlowController::SwitchToEnterpriseProfileWelcome( EnterpriseProfileWelcomeUI::ScreenType type, - base::OnceCallback proceed_callback) { + signin::SigninChoiceCallback proceed_callback) { DCHECK(IsInitialized()); host_->ShowScreen(contents(), GURL(chrome::kChromeUIEnterpriseProfileWelcomeURL), @@ -150,7 +150,7 @@ void ProfilePickerSignedInFlowController::SwitchToSyncConfirmationFinished() { void ProfilePickerSignedInFlowController:: SwitchToEnterpriseProfileWelcomeFinished( EnterpriseProfileWelcomeUI::ScreenType type, - base::OnceCallback proceed_callback) { + signin::SigninChoiceCallback proceed_callback) { DCHECK(IsInitialized()); // Initialize the WebUI page once we know it's committed. EnterpriseProfileWelcomeUI* enterprise_profile_welcome_ui = diff --git a/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.h b/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.h index 0a6b50dfb25c64..33c0b0619da7ea 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.h +++ b/chrome/browser/ui/views/profiles/profile_picker_signed_in_flow_controller.h @@ -61,7 +61,7 @@ class ProfilePickerSignedInFlowController // screen. void SwitchToEnterpriseProfileWelcome( EnterpriseProfileWelcomeUI::ScreenType type, - base::OnceCallback proceed_callback); + signin::SigninChoiceCallback proceed_callback); // When the sign-in flow cannot be completed because another profile at // `profile_path` is already syncing with a chosen account, shows the profile @@ -94,7 +94,7 @@ class ProfilePickerSignedInFlowController void SwitchToSyncConfirmationFinished(); void SwitchToEnterpriseProfileWelcomeFinished( EnterpriseProfileWelcomeUI::ScreenType type, - base::OnceCallback proceed_callback); + signin::SigninChoiceCallback proceed_callback); // Returns whether the flow is initialized (i.e. whether `Init()` has been // called). diff --git a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc index 468d38482c05f4..df6e5c4aaf98a1 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc @@ -224,8 +224,8 @@ void ProfilePickerTurnSyncOnDelegate::ShowEnterpriseWelcome( void ProfilePickerTurnSyncOnDelegate::OnEnterpriseWelcomeClosed( EnterpriseProfileWelcomeUI::ScreenType type, - bool proceed) { - if (!proceed) { + signin::SigninChoice choice) { + if (choice == signin::SIGNIN_CHOICE_CANCEL) { LogOutcome(ProfileMetrics::ProfileSignedInFlowOutcome:: kAbortedOnEnterpriseWelcome); // The callback provided by TurnSyncOnHelper must be called, UI_CLOSED @@ -237,6 +237,8 @@ void ProfilePickerTurnSyncOnDelegate::OnEnterpriseWelcomeClosed( return; } + DCHECK_EQ(choice, signin::SIGNIN_CHOICE_NEW_PROFILE); + switch (type) { case EnterpriseProfileWelcomeUI::ScreenType::kEntepriseAccountSyncEnabled: ShowSyncConfirmationScreen(); diff --git a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h index 8c622346f39c3f..98d24018928688 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h +++ b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h @@ -67,7 +67,7 @@ class ProfilePickerTurnSyncOnDelegate : public TurnSyncOnHelper::Delegate, // Shows the enterprise welcome screen. void ShowEnterpriseWelcome(EnterpriseProfileWelcomeUI::ScreenType type); void OnEnterpriseWelcomeClosed(EnterpriseProfileWelcomeUI::ScreenType type, - bool proceed); + signin::SigninChoice choice); // Reports metric with the outcome of the turn-sync-on flow. void LogOutcome(ProfileMetrics::ProfileSignedInFlowOutcome outcome); diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index 3700e7f3130ce6..3e502f9d652433 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc @@ -53,6 +53,7 @@ #include "chrome/browser/ui/webui/signin/profile_picker_handler.h" #include "chrome/browser/ui/webui/signin/profile_picker_ui.h" #include "chrome/browser/ui/webui/signin/signin_url_utils.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/profile_deletion_observer.h" @@ -1270,7 +1271,7 @@ class ProfilePickerEnterpriseCreationFlowBrowserTest void ExpectEnterpriseScreenTypeAndProceed( EnterpriseProfileWelcomeUI::ScreenType expected_type, - bool proceed) { + signin::SigninChoice choice) { EnterpriseProfileWelcomeHandler* handler = web_contents() ->GetWebUI() @@ -1280,7 +1281,7 @@ class ProfilePickerEnterpriseCreationFlowBrowserTest EXPECT_EQ(handler->GetTypeForTesting(), expected_type); // Simulate clicking on the next button. - handler->CallProceedCallbackForTesting(proceed); + handler->CallProceedCallbackForTesting(choice); } }; @@ -1299,7 +1300,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, ExpectEnterpriseScreenTypeAndProceed( /*expected_type=*/EnterpriseProfileWelcomeUI::ScreenType:: kEntepriseAccountSyncEnabled, - /*proceed=*/true); + /*choice=*/signin::SIGNIN_CHOICE_NEW_PROFILE); WaitForLoadStop(GetSyncConfirmationURL()); // Simulate finishing the flow with "No, thanks". @@ -1356,7 +1357,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, ExpectEnterpriseScreenTypeAndProceed( /*expected_type=*/EnterpriseProfileWelcomeUI::ScreenType:: kConsumerAccountSyncDisabled, - /*proceed=*/true); + /*choice=*/signin::SIGNIN_CHOICE_NEW_PROFILE); Browser* new_browser = BrowserAddedWaiter(2u).Wait(); WaitForLoadStop(GURL("chrome://newtab/"), @@ -1400,7 +1401,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, ExpectEnterpriseScreenTypeAndProceed( /*expected_type=*/EnterpriseProfileWelcomeUI::ScreenType:: kEntepriseAccountSyncEnabled, - /*proceed=*/true); + /*choice=*/signin::SIGNIN_CHOICE_NEW_PROFILE); WaitForLoadStop(GetSyncConfirmationURL()); // Simulate finishing the flow with "Configure sync". @@ -1454,7 +1455,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, Cancel) { ExpectEnterpriseScreenTypeAndProceed( /*expected_type=*/EnterpriseProfileWelcomeUI::ScreenType:: kEntepriseAccountSyncEnabled, - /*proceed=*/false); + /*choice=*/signin::SIGNIN_CHOICE_CANCEL); // As the profile creation flow was opened directly, the window is closed now. WaitForPickerClosed(); diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc index ee8d37289aa5ce..3bf20f9c205727 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/webui/signin/profile_customization_ui.h" #include "chrome/browser/ui/webui/signin/signin_url_utils.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h" #include "chrome/common/url_constants.h" #include "chrome/common/webui_url_constants.h" @@ -144,7 +145,7 @@ SigninViewControllerDelegateViews::CreateEnterpriseConfirmationWebView( Browser* browser, const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback) { + signin::SigninChoiceCallback callback) { std::unique_ptr web_view = CreateDialogWebView( browser, GURL(chrome::kChromeUIEnterpriseProfileWelcomeURL), kSyncConfirmationDialogHeight, kSyncConfirmationDialogWidth, @@ -421,7 +422,7 @@ SigninViewControllerDelegate::CreateEnterpriseConfirmationDelegate( Browser* browser, const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback) { + signin::SigninChoiceCallback callback) { return new SigninViewControllerDelegateViews( SigninViewControllerDelegateViews::CreateEnterpriseConfirmationWebView( browser, account_info, profile_color, std::move(callback)), diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h index 995836978ff663..5c487004355846 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h @@ -14,6 +14,7 @@ #include "chrome/browser/ui/profile_chooser_constants.h" #include "chrome/browser/ui/signin_view_controller_delegate.h" #include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/base/signin_buildflags.h" #include "content/public/browser/web_contents_delegate.h" #include "third_party/skia/include/core/SkColor.h" @@ -76,7 +77,7 @@ class SigninViewControllerDelegateViews Browser* browser, const AccountInfo& account_info, SkColor profile_color, - base::OnceCallback callback); + signin::SigninChoiceCallback callback); #endif // views::DialogDelegateView: diff --git a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc index 512302ef3a2491..3ee7464ebda8b3 100644 --- a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc +++ b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc @@ -94,7 +94,7 @@ EnterpriseProfileWelcomeHandler::EnterpriseProfileWelcomeHandler( EnterpriseProfileWelcomeUI::ScreenType type, const AccountInfo& account_info, absl::optional profile_color, - base::OnceCallback proceed_callback) + signin::SigninChoiceCallback proceed_callback) : browser_(browser), type_(type), email_(base::UTF8ToUTF16(account_info.email)), @@ -199,13 +199,13 @@ void EnterpriseProfileWelcomeHandler::HandleInitializedWithSize( void EnterpriseProfileWelcomeHandler::HandleProceed( const base::ListValue* args) { if (proceed_callback_) - std::move(proceed_callback_).Run(true); + std::move(proceed_callback_).Run(signin::SIGNIN_CHOICE_NEW_PROFILE); } void EnterpriseProfileWelcomeHandler::HandleCancel( const base::ListValue* args) { if (proceed_callback_) - std::move(proceed_callback_).Run(false); + std::move(proceed_callback_).Run(signin::SIGNIN_CHOICE_CANCEL); } void EnterpriseProfileWelcomeHandler::UpdateProfileInfo( @@ -306,7 +306,7 @@ EnterpriseProfileWelcomeHandler::GetTypeForTesting() { } void EnterpriseProfileWelcomeHandler::CallProceedCallbackForTesting( - bool proceed) { + signin::SigninChoice choice) { if (proceed_callback_) - std::move(proceed_callback_).Run(proceed); + std::move(proceed_callback_).Run(choice); } diff --git a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.h b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.h index f4bab869463cf0..3c75bf3541dc93 100644 --- a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.h +++ b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.h @@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/web_ui_message_handler.h" #include "google_apis/gaia/core_account_id.h" @@ -41,7 +42,7 @@ class EnterpriseProfileWelcomeHandler EnterpriseProfileWelcomeUI::ScreenType type, const AccountInfo& account_info, absl::optional profile_color, - base::OnceCallback proceed_callback); + signin::SigninChoiceCallback proceed_callback); ~EnterpriseProfileWelcomeHandler() override; EnterpriseProfileWelcomeHandler(const EnterpriseProfileWelcomeHandler&) = @@ -69,7 +70,7 @@ class EnterpriseProfileWelcomeHandler // Access to construction parameters for tests. EnterpriseProfileWelcomeUI::ScreenType GetTypeForTesting(); - void CallProceedCallbackForTesting(bool proceed); + void CallProceedCallbackForTesting(signin::SigninChoice choice); private: void HandleInitialized(const base::ListValue* args); @@ -108,7 +109,7 @@ class EnterpriseProfileWelcomeHandler const std::string domain_name_; const CoreAccountId account_id_; absl::optional profile_color_; - base::OnceCallback proceed_callback_; + signin::SigninChoiceCallback proceed_callback_; }; #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_ENTERPRISE_PROFILE_WELCOME_HANDLER_H_ diff --git a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.cc b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.cc index a041fbf56fbd94..cc8ae331527bc8 100644 --- a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.cc +++ b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.cc @@ -7,6 +7,7 @@ #include "base/callback_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/chromium_strings.h" @@ -55,7 +56,7 @@ void EnterpriseProfileWelcomeUI::Initialize( EnterpriseProfileWelcomeUI::ScreenType type, const AccountInfo& account_info, absl::optional profile_color, - base::OnceCallback proceed_callback) { + signin::SigninChoiceCallback proceed_callback) { auto handler = std::make_unique( browser, type, account_info, profile_color, std::move(proceed_callback)); handler_ = handler.get(); diff --git a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h index 3fa43da819bc60..b2c9f99858eda6 100644 --- a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h +++ b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h @@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/webui/signin/signin_utils.h" #include "content/public/browser/web_ui_controller.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/skia/include/core/SkColor.h" @@ -41,7 +42,7 @@ class EnterpriseProfileWelcomeUI : public content::WebUIController { ScreenType type, const AccountInfo& account_info, absl::optional profile_color, - base::OnceCallback proceed_callback); + signin::SigninChoiceCallback proceed_callback); // Allows tests to trigger page events. EnterpriseProfileWelcomeHandler* GetHandlerForTesting(); diff --git a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc index 16cdfdce33e061..3ffbe13fcc80ed 100644 --- a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc +++ b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc @@ -85,13 +85,15 @@ void OnProfileCheckComplete(const AccountInfo& account_info, account_info, GenerateNewProfileColor(entry).color, base::BindOnce( [](signin::SigninChoiceCallback callback, Browser* browser, - bool prompt_for_new_profile, bool create_profile) { + bool prompt_for_new_profile, signin::SigninChoice choice) { browser->signin_view_controller()->CloseModalSignin(); - std::move(callback).Run( - create_profile ? prompt_for_new_profile - ? signin::SIGNIN_CHOICE_NEW_PROFILE - : signin::SIGNIN_CHOICE_CONTINUE - : signin::SIGNIN_CHOICE_CANCEL); + signin::SigninChoice result = signin::SIGNIN_CHOICE_CANCEL; + if (choice != signin::SIGNIN_CHOICE_CANCEL) { + result = prompt_for_new_profile + ? signin::SIGNIN_CHOICE_NEW_PROFILE + : signin::SIGNIN_CHOICE_CONTINUE; + } + std::move(callback).Run(result); }, std::move(callback), browser.get(), prompt_for_new_profile)); }