Commit badf4035 authored by Ella Ge's avatar Ella Ge Committed by Chromium LUCI CQ

Convert c/b/ui/webui/signin/ from base::Bind to Once/Repeating

Bug: 1152282
Change-Id: I1cecfcf7a516e97209fa8edd415be134dab2e0ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601064Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839130}
parent 5ef2e146
...@@ -212,8 +212,9 @@ DiceTurnSyncOnHelper::DiceTurnSyncOnHelper( ...@@ -212,8 +212,9 @@ DiceTurnSyncOnHelper::DiceTurnSyncOnHelper(
shutdown_subscription_( shutdown_subscription_(
DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance() DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance()
->Get(profile) ->Get(profile)
->Subscribe(base::Bind(&DiceTurnSyncOnHelper::AbortAndDelete, ->Subscribe(base::AdaptCallbackForRepeating(
base::Unretained(this)))) { base::BindOnce(&DiceTurnSyncOnHelper::AbortAndDelete,
base::Unretained(this))))) {
DCHECK(delegate_); DCHECK(delegate_);
DCHECK(profile_); DCHECK(profile_);
// Should not start syncing if the profile is already authenticated // Should not start syncing if the profile is already authenticated
...@@ -605,8 +606,8 @@ void DiceTurnSyncOnHelper::SwitchToProfile(Profile* new_profile) { ...@@ -605,8 +606,8 @@ void DiceTurnSyncOnHelper::SwitchToProfile(Profile* new_profile) {
shutdown_subscription_ = shutdown_subscription_ =
DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance() DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance()
->Get(profile_) ->Get(profile_)
->Subscribe(base::Bind(&DiceTurnSyncOnHelper::AbortAndDelete, ->Subscribe(base::AdaptCallbackForRepeating(base::BindOnce(
base::Unretained(this))); &DiceTurnSyncOnHelper::AbortAndDelete, base::Unretained(this))));
delegate_->SwitchToProfile(new_profile); delegate_->SwitchToProfile(new_profile);
// Since this is a fresh profile, it's better to remove the token if the user // Since this is a fresh profile, it's better to remove the token if the user
// aborts the signin. // aborts the signin.
......
...@@ -301,7 +301,7 @@ void OnSyncSetupComplete(Profile* profile, ...@@ -301,7 +301,7 @@ void OnSyncSetupComplete(Profile* profile,
if (!has_primary_account) { if (!has_primary_account) {
BrowserList::CloseAllBrowsersWithProfile( BrowserList::CloseAllBrowsersWithProfile(
profile, base::Bind(&LockProfileAndShowUserManager), profile, base::BindRepeating(&LockProfileAndShowUserManager),
// Cannot be called because skip_beforeunload is true. // Cannot be called because skip_beforeunload is true.
BrowserList::CloseCallback(), BrowserList::CloseCallback(),
/*skip_beforeunload=*/true); /*skip_beforeunload=*/true);
...@@ -351,8 +351,9 @@ void InlineSigninHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) { ...@@ -351,8 +351,9 @@ void InlineSigninHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) {
// window won't be opened until now. // window won't be opened until now.
UnlockProfileAndHideLoginUI(profile_->GetPath(), handler_.get()); UnlockProfileAndHideLoginUI(profile_->GetPath(), handler_.get());
profiles::OpenBrowserWindowForProfile( profiles::OpenBrowserWindowForProfile(
base::Bind(&InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened, base::BindRepeating(
base::Unretained(this), result), &InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened,
base::Unretained(this), result),
true, false, true, profile_, create_status_); true, false, true, profile_, create_status_);
} else { } else {
OnClientOAuthSuccessAndBrowserOpened(result, profile_, create_status_); OnClientOAuthSuccessAndBrowserOpened(result, profile_, create_status_);
...@@ -465,7 +466,7 @@ void InlineSigninHelper::UntrustedSigninConfirmed( ...@@ -465,7 +466,7 @@ void InlineSigninHelper::UntrustedSigninConfirmed(
base::RecordAction(base::UserMetricsAction("Signin_Undo_Signin")); base::RecordAction(base::UserMetricsAction("Signin_Undo_Signin"));
BrowserList::CloseAllBrowsersWithProfile( BrowserList::CloseAllBrowsersWithProfile(
profile_, base::Bind(&LockProfileAndShowUserManager), profile_, base::BindRepeating(&LockProfileAndShowUserManager),
// Cannot be called because skip_beforeunload is true. // Cannot be called because skip_beforeunload is true.
BrowserList::CloseCallback(), BrowserList::CloseCallback(),
/*skip_beforeunload=*/true); /*skip_beforeunload=*/true);
......
...@@ -72,7 +72,8 @@ class InlineLoginHandlerImpl : public InlineLoginHandler { ...@@ -72,7 +72,8 @@ class InlineLoginHandlerImpl : public InlineLoginHandler {
base::Value edu_login_params) override; base::Value edu_login_params) override;
// This struct exists to pass parameters to the FinishCompleteLogin() method, // This struct exists to pass parameters to the FinishCompleteLogin() method,
// since the base::Bind() call does not support this many template args. // since the base::BindRepeating() call does not support this many template
// args.
struct FinishCompleteLoginParams { struct FinishCompleteLoginParams {
public: public:
FinishCompleteLoginParams(InlineLoginHandlerImpl* handler, FinishCompleteLoginParams(InlineLoginHandlerImpl* handler,
......
...@@ -289,8 +289,8 @@ void ProfilePickerHandler::HandleLaunchGuestProfile( ...@@ -289,8 +289,8 @@ void ProfilePickerHandler::HandleLaunchGuestProfile(
// TODO(crbug.com/1063856): Add check |IsGuestModeEnabled| once policy // TODO(crbug.com/1063856): Add check |IsGuestModeEnabled| once policy
// checking has been added to the UI. // checking has been added to the UI.
profiles::SwitchToGuestProfile( profiles::SwitchToGuestProfile(
base::Bind(&ProfilePickerHandler::OnSwitchToProfileComplete, base::BindRepeating(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), false, false)); weak_factory_.GetWeakPtr(), false, false));
} }
void ProfilePickerHandler::HandleAskOnStartupChanged( void ProfilePickerHandler::HandleAskOnStartupChanged(
...@@ -437,8 +437,8 @@ void ProfilePickerHandler::OnProfileCreationSuccess( ...@@ -437,8 +437,8 @@ void ProfilePickerHandler::OnProfileCreationSuccess(
RecordNewProfileSpec(profile_color, create_shortcut); RecordNewProfileSpec(profile_color, create_shortcut);
// Launch profile and close the picker. // Launch profile and close the picker.
profiles::OpenBrowserWindowForProfile( profiles::OpenBrowserWindowForProfile(
base::Bind(&ProfilePickerHandler::OnSwitchToProfileComplete, base::BindRepeating(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), true, false), weak_factory_.GetWeakPtr(), true, false),
false, // Don't create a window if one already exists. false, // Don't create a window if one already exists.
true, // Create a first run window. true, // Create a first run window.
false, // There is no need to unblock all extensions because we only open false, // There is no need to unblock all extensions because we only open
......
...@@ -92,8 +92,8 @@ void SigninCreateProfileHandler::OpenNewWindowForProfile( ...@@ -92,8 +92,8 @@ void SigninCreateProfileHandler::OpenNewWindowForProfile(
Profile* profile, Profile* profile,
Profile::CreateStatus status) { Profile::CreateStatus status) {
profiles::OpenBrowserWindowForProfile( profiles::OpenBrowserWindowForProfile(
base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback, base::BindRepeating(&SigninCreateProfileHandler::OnBrowserReadyCallback,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
false, // Don't create a window if one already exists. false, // Don't create a window if one already exists.
true, // Create a first run window. true, // Create a first run window.
false, // There is no need to unblock all extensions because we only open false, // There is no need to unblock all extensions because we only open
......
...@@ -441,9 +441,9 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) { ...@@ -441,9 +441,9 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) {
void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) { void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) {
if (IsGuestModeEnabled()) { if (IsGuestModeEnabled()) {
profiles::SwitchToGuestProfile( profiles::SwitchToGuestProfile(base::BindRepeating(
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, &UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} else { } else {
// The UI should have prevented the user from allowing the selection of // The UI should have prevented the user from allowing the selection of
// guest mode. // guest mode.
...@@ -492,8 +492,8 @@ void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) { ...@@ -492,8 +492,8 @@ void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {
profiles::SwitchToProfile( profiles::SwitchToProfile(
*profile_path, false, /* reuse any existing windows */ *profile_path, false, /* reuse any existing windows */
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, base::BindRepeating(&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
void UserManagerScreenHandler::HandleRemoveUserWarningLoadStats( void UserManagerScreenHandler::HandleRemoveUserWarningLoadStats(
...@@ -841,8 +841,9 @@ void UserManagerScreenHandler::ReportAuthenticationResult( ...@@ -841,8 +841,9 @@ void UserManagerScreenHandler::ReportAuthenticationResult(
if (success) { if (success) {
profiles::SwitchToProfile( profiles::SwitchToProfile(
authenticating_profile_path_, true, authenticating_profile_path_, true,
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, base::BindRepeating(
weak_ptr_factory_.GetWeakPtr())); &UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
} else { } else {
web_ui()->CallJavascriptFunctionUnsafe( web_ui()->CallJavascriptFunctionUnsafe(
"cr.ui.UserManager.showSignInError", base::Value(0), "cr.ui.UserManager.showSignInError", base::Value(0),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment