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(
shutdown_subscription_(
DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance()
->Get(profile)
->Subscribe(base::Bind(&DiceTurnSyncOnHelper::AbortAndDelete,
base::Unretained(this)))) {
->Subscribe(base::AdaptCallbackForRepeating(
base::BindOnce(&DiceTurnSyncOnHelper::AbortAndDelete,
base::Unretained(this))))) {
DCHECK(delegate_);
DCHECK(profile_);
// Should not start syncing if the profile is already authenticated
......@@ -605,8 +606,8 @@ void DiceTurnSyncOnHelper::SwitchToProfile(Profile* new_profile) {
shutdown_subscription_ =
DiceTurnSyncOnHelperShutdownNotifierFactory::GetInstance()
->Get(profile_)
->Subscribe(base::Bind(&DiceTurnSyncOnHelper::AbortAndDelete,
base::Unretained(this)));
->Subscribe(base::AdaptCallbackForRepeating(base::BindOnce(
&DiceTurnSyncOnHelper::AbortAndDelete, base::Unretained(this))));
delegate_->SwitchToProfile(new_profile);
// Since this is a fresh profile, it's better to remove the token if the user
// aborts the signin.
......
......@@ -301,7 +301,7 @@ void OnSyncSetupComplete(Profile* profile,
if (!has_primary_account) {
BrowserList::CloseAllBrowsersWithProfile(
profile, base::Bind(&LockProfileAndShowUserManager),
profile, base::BindRepeating(&LockProfileAndShowUserManager),
// Cannot be called because skip_beforeunload is true.
BrowserList::CloseCallback(),
/*skip_beforeunload=*/true);
......@@ -351,8 +351,9 @@ void InlineSigninHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) {
// window won't be opened until now.
UnlockProfileAndHideLoginUI(profile_->GetPath(), handler_.get());
profiles::OpenBrowserWindowForProfile(
base::Bind(&InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened,
base::Unretained(this), result),
base::BindRepeating(
&InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened,
base::Unretained(this), result),
true, false, true, profile_, create_status_);
} else {
OnClientOAuthSuccessAndBrowserOpened(result, profile_, create_status_);
......@@ -465,7 +466,7 @@ void InlineSigninHelper::UntrustedSigninConfirmed(
base::RecordAction(base::UserMetricsAction("Signin_Undo_Signin"));
BrowserList::CloseAllBrowsersWithProfile(
profile_, base::Bind(&LockProfileAndShowUserManager),
profile_, base::BindRepeating(&LockProfileAndShowUserManager),
// Cannot be called because skip_beforeunload is true.
BrowserList::CloseCallback(),
/*skip_beforeunload=*/true);
......
......@@ -72,7 +72,8 @@ class InlineLoginHandlerImpl : public InlineLoginHandler {
base::Value edu_login_params) override;
// 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 {
public:
FinishCompleteLoginParams(InlineLoginHandlerImpl* handler,
......
......@@ -289,8 +289,8 @@ void ProfilePickerHandler::HandleLaunchGuestProfile(
// TODO(crbug.com/1063856): Add check |IsGuestModeEnabled| once policy
// checking has been added to the UI.
profiles::SwitchToGuestProfile(
base::Bind(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), false, false));
base::BindRepeating(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), false, false));
}
void ProfilePickerHandler::HandleAskOnStartupChanged(
......@@ -437,8 +437,8 @@ void ProfilePickerHandler::OnProfileCreationSuccess(
RecordNewProfileSpec(profile_color, create_shortcut);
// Launch profile and close the picker.
profiles::OpenBrowserWindowForProfile(
base::Bind(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), true, false),
base::BindRepeating(&ProfilePickerHandler::OnSwitchToProfileComplete,
weak_factory_.GetWeakPtr(), true, false),
false, // Don't create a window if one already exists.
true, // Create a first run window.
false, // There is no need to unblock all extensions because we only open
......
......@@ -92,8 +92,8 @@ void SigninCreateProfileHandler::OpenNewWindowForProfile(
Profile* profile,
Profile::CreateStatus status) {
profiles::OpenBrowserWindowForProfile(
base::Bind(&SigninCreateProfileHandler::OnBrowserReadyCallback,
weak_ptr_factory_.GetWeakPtr()),
base::BindRepeating(&SigninCreateProfileHandler::OnBrowserReadyCallback,
weak_ptr_factory_.GetWeakPtr()),
false, // Don't create a window if one already exists.
true, // Create a first run window.
false, // There is no need to unblock all extensions because we only open
......
......@@ -441,9 +441,9 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) {
void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) {
if (IsGuestModeEnabled()) {
profiles::SwitchToGuestProfile(
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
profiles::SwitchToGuestProfile(base::BindRepeating(
&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
} else {
// The UI should have prevented the user from allowing the selection of
// guest mode.
......@@ -492,8 +492,8 @@ void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {
profiles::SwitchToProfile(
*profile_path, false, /* reuse any existing windows */
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
base::BindRepeating(&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
}
void UserManagerScreenHandler::HandleRemoveUserWarningLoadStats(
......@@ -841,8 +841,9 @@ void UserManagerScreenHandler::ReportAuthenticationResult(
if (success) {
profiles::SwitchToProfile(
authenticating_profile_path_, true,
base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
base::BindRepeating(
&UserManagerScreenHandler::OnSwitchToProfileComplete,
weak_ptr_factory_.GetWeakPtr()));
} else {
web_ui()->CallJavascriptFunctionUnsafe(
"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