Commit 97cbd08c authored by Jesse McKenna's avatar Jesse McKenna Committed by Commit Bot

CodeHealthRotation: migrate Bind to BindOnce/Repeating in c/b/profiles/profile_window*

This change migrates uses of base::Bind to BindOnce/BindRepeating, and
uses of base::Callback to OnceCallback/RepeatingCallback.

Please see crbug.com/714018 for full details about the migration.

Bug: 1147284
Change-Id: Ia12d78b875b9853f8b23ac23b8ff0f36df9867bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530252Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
Cr-Commit-Position: refs/heads/master@{#826806}
parent 1367322f
......@@ -92,7 +92,7 @@ void UnblockExtensions(Profile* profile) {
void OnUserManagerSystemProfileCreated(
const base::FilePath& profile_path_to_focus,
profiles::UserManagerAction user_manager_action,
const base::Callback<void(Profile*, const std::string&)>& callback,
base::OnceCallback<void(Profile*, const std::string&)> callback,
Profile* system_profile,
Profile::CreateStatus status) {
if (status != Profile::CREATE_STATUS_INITIALIZED || callback.is_null())
......@@ -120,7 +120,7 @@ void OnUserManagerSystemProfileCreated(
profiles::USER_MANAGER_SELECT_PROFILE_CHROME_SETTINGS) {
page += profiles::kUserManagerSelectProfileChromeSettings;
}
callback.Run(system_profile, page);
std::move(callback).Run(system_profile, page);
}
// Called in profiles::LoadProfileAsync once profile is loaded. It runs
......@@ -305,7 +305,7 @@ void CloseGuestProfileWindows() {
if (profile) {
BrowserList::CloseAllBrowsersWithProfile(
profile, base::Bind(&ProfileBrowserCloseSuccess),
profile, base::BindRepeating(&ProfileBrowserCloseSuccess),
BrowserList::CloseCallback(), false);
}
}
......@@ -334,7 +334,7 @@ void LockProfile(Profile* profile) {
DCHECK(profile);
if (profile) {
BrowserList::CloseAllBrowsersWithProfile(
profile, base::Bind(&LockBrowserCloseSuccess),
profile, base::BindRepeating(&LockBrowserCloseSuccess),
BrowserList::CloseCallback(), false);
}
}
......@@ -382,20 +382,21 @@ bool IsLockAvailable(Profile* profile) {
void CloseProfileWindows(Profile* profile) {
DCHECK(profile);
BrowserList::CloseAllBrowsersWithProfile(
profile, base::Bind(&ProfileBrowserCloseSuccess),
profile, base::BindRepeating(&ProfileBrowserCloseSuccess),
BrowserList::CloseCallback(), false);
}
void CreateSystemProfileForUserManager(
const base::FilePath& profile_path_to_focus,
profiles::UserManagerAction user_manager_action,
const base::Callback<void(Profile*, const std::string&)>& callback) {
base::RepeatingCallback<void(Profile*, const std::string&)> callback) {
// Create the system profile, if necessary, and open the User Manager
// from the system profile.
g_browser_process->profile_manager()->CreateProfileAsync(
ProfileManager::GetSystemProfilePath(),
base::BindRepeating(&OnUserManagerSystemProfileCreated,
profile_path_to_focus, user_manager_action, callback),
profile_path_to_focus, user_manager_action,
std::move(callback)),
base::string16(), std::string());
}
......
......@@ -115,7 +115,7 @@ bool IsLockAvailable(Profile* profile);
void CreateSystemProfileForUserManager(
const base::FilePath& profile_path_to_focus,
profiles::UserManagerAction user_manager_action,
const base::Callback<void(Profile*, const std::string&)>& callback);
base::RepeatingCallback<void(Profile*, const std::string&)> callback);
// Converts from modes in the avatar menu to modes understood by
// ProfileMenuView.
......
......@@ -399,11 +399,11 @@ IN_PROC_BROWSER_TEST_F(ProfileWindowBrowserTest,
class ProfileWindowWebUIBrowserTest : public WebUIBrowserTest {
public:
void OnSystemProfileCreated(std::string* url_to_test,
const base::Closure& quit_loop,
base::OnceClosure quit_loop,
Profile* profile,
const std::string& url) {
*url_to_test = url;
quit_loop.Run();
std::move(quit_loop).Run();
}
private:
......@@ -421,10 +421,9 @@ IN_PROC_BROWSER_TEST_F(ProfileWindowWebUIBrowserTest,
profiles::CreateSystemProfileForUserManager(
browser()->profile()->GetPath(),
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION,
base::Bind(&ProfileWindowWebUIBrowserTest::OnSystemProfileCreated,
base::Unretained(this),
&url_to_test,
run_loop.QuitClosure()));
base::BindRepeating(
&ProfileWindowWebUIBrowserTest::OnSystemProfileCreated,
base::Unretained(this), &url_to_test, run_loop.QuitClosure()));
run_loop.Run();
ui_test_utils::NavigateToURL(browser(), GURL(url_to_test));
......@@ -442,12 +441,10 @@ IN_PROC_BROWSER_TEST_F(ProfileWindowWebUIBrowserTest,
std::string url_to_test;
base::RunLoop run_loop;
profiles::CreateSystemProfileForUserManager(
expected_path,
profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION,
base::Bind(&ProfileWindowWebUIBrowserTest::OnSystemProfileCreated,
base::Unretained(this),
&url_to_test,
run_loop.QuitClosure()));
expected_path, profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION,
base::BindRepeating(
&ProfileWindowWebUIBrowserTest::OnSystemProfileCreated,
base::Unretained(this), &url_to_test, run_loop.QuitClosure()));
run_loop.Run();
ui_test_utils::NavigateToURL(browser(), GURL(url_to_test));
......
......@@ -212,10 +212,11 @@ void UserManager::Show(
user_manager->set_user_manager_started_showing(base::Time::Now());
profiles::CreateSystemProfileForUserManager(
profile_path_to_focus, user_manager_action,
base::Bind(&UserManagerView::OnSystemProfileCreated,
base::Passed(base::WrapUnique(user_manager)),
base::Owned(new base::AutoReset<bool>(
&g_is_user_manager_view_under_construction, true))));
base::BindRepeating(
&UserManagerView::OnSystemProfileCreated,
base::Passed(base::WrapUnique(user_manager)),
base::Owned(new base::AutoReset<bool>(
&g_is_user_manager_view_under_construction, true))));
}
// static
......
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