Commit e9810d2a authored by David Bokan's avatar David Bokan Committed by Chromium LUCI CQ

Update extensions/browser Bind calls to {Once,Repeating}

This CL cleans up some remaining trivial callsites currently using
base::Bind where the called method already takes a modern
{Once,Repeating}Callback.

Bug: 1152268
Change-Id: I0c36a55354195899f6c2a0c134ac4da63a5a4339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602557Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840291}
parent 6a6cd20a
......@@ -251,8 +251,8 @@ class DataItemTest : public testing::Test {
DataItem::GetRegisteredValuesForExtension(
context_.get(), value_store_cache_.get(), task_runner_.get(),
extension_id,
base::Bind(&GetRegisteredItemsCallback, run_loop.QuitClosure(), &result,
&items_value));
base::BindOnce(&GetRegisteredItemsCallback, run_loop.QuitClosure(),
&result, &items_value));
run_loop.Run();
if (result != OperationResult::kSuccess)
......
......@@ -69,8 +69,8 @@ void LockScreenValueStoreMigratorImpl::StartMigrationForExtension(
const ExtensionId& extension_id) {
DataItem::GetRegisteredValuesForExtension(
context_, source_store_cache_, task_runner_, extension_id,
base::Bind(&LockScreenValueStoreMigratorImpl::OnGotItemsForExtension,
weak_ptr_factory_.GetWeakPtr(), extension_id));
base::BindOnce(&LockScreenValueStoreMigratorImpl::OnGotItemsForExtension,
weak_ptr_factory_.GetWeakPtr(), extension_id));
}
void LockScreenValueStoreMigratorImpl::OnGotItemsForExtension(
......
......@@ -246,8 +246,8 @@ class LockScreenValueStoreMigratorImplTest : public testing::Test {
base::RunLoop run_loop;
DataItem::GetRegisteredValuesForExtension(
context_.get(), storage, task_runner_.get(), extension_id,
base::Bind(&GetRegisteredItemsCallback, run_loop.QuitClosure(), &result,
&items_value));
base::BindOnce(&GetRegisteredItemsCallback, run_loop.QuitClosure(),
&result, &items_value));
run_loop.Run();
if (result != OperationResult::kSuccess) {
......@@ -1012,7 +1012,7 @@ TEST_F(LockScreenValueStoreMigratorImplTest,
// Clear data for app 1.
migrator()->ClearDataForExtension(
app->id(), base::Bind(&ExpectNotRun, "clear data callback"));
app->id(), base::BindOnce(&ExpectNotRun, "clear data callback"));
EXPECT_FALSE(migrator()->IsMigratingExtensionData(app->id()));
DeleteMigrator();
......@@ -1048,7 +1048,7 @@ TEST_F(LockScreenValueStoreMigratorImplTest,
// Clear data for app 1.
migrator()->ClearDataForExtension(
app->id(), base::Bind(&ExpectNotRun, "clear data callback"));
app->id(), base::BindOnce(&ExpectNotRun, "clear data callback"));
EXPECT_FALSE(migrator()->IsMigratingExtensionData(app->id()));
// This should clear the target storage.
......
......@@ -424,8 +424,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersSuccess) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -463,8 +463,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersAsyncSuccess) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -500,8 +500,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersTwoExtensions) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -563,8 +563,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -595,8 +595,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -642,8 +642,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -682,8 +682,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersNoListener) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -703,8 +703,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersNotArray) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -725,8 +725,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......@@ -746,8 +746,8 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersInvalidPrinterValue) {
base::RunLoop run_loop;
base::ListValue printers;
StartGetPrintersRequest(base::Bind(&AppendPrintersAndRunCallbackIfDone,
&printers, run_loop.QuitClosure()));
StartGetPrintersRequest(base::BindRepeating(
&AppendPrintersAndRunCallbackIfDone, &printers, run_loop.QuitClosure()));
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......
......@@ -112,7 +112,7 @@ class UsbFindDevicesFunction : public UsbExtensionFunction {
uint16_t vendor_id_;
uint16_t product_id_;
std::unique_ptr<base::ListValue> result_;
base::Closure barrier_;
base::RepeatingClosure barrier_;
DISALLOW_COPY_AND_ASSIGN(UsbFindDevicesFunction);
};
......
......@@ -67,8 +67,8 @@ ExtensionMessageFilter::ExtensionMessageFilter(int render_process_id,
DCHECK_CURRENTLY_ON(BrowserThread::UI);
shutdown_notifier_subscription_ =
ShutdownNotifierFactory::GetInstance()->Get(context)->Subscribe(
base::Bind(&ExtensionMessageFilter::ShutdownOnUIThread,
base::Unretained(this)));
base::BindRepeating(&ExtensionMessageFilter::ShutdownOnUIThread,
base::Unretained(this)));
}
void ExtensionMessageFilter::EnsureShutdownNotifierFactoryBuilt() {
......
......@@ -125,7 +125,7 @@ class MimeHandlerViewTest : public extensions::ExtensionApiTest {
void RunTestWithUrl(const GURL& url) {
// Use the testing subclass of MimeHandlerViewGuest.
GetGuestViewManager()->RegisterTestGuestViewType<MimeHandlerViewGuest>(
base::Bind(&TestMimeHandlerViewGuest::Create));
base::BindRepeating(&TestMimeHandlerViewGuest::Create));
const extensions::Extension* extension = LoadTestExtension();
ASSERT_TRUE(extension);
......@@ -583,7 +583,7 @@ IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, AdoptNodeInOnLoadDoesNotCrash) {
IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, DoNotLoadInSandboxedFrame) {
// Use the testing subclass of MimeHandlerViewGuest.
GetGuestViewManager()->RegisterTestGuestViewType<MimeHandlerViewGuest>(
base::Bind(&TestMimeHandlerViewGuest::Create));
base::BindRepeating(&TestMimeHandlerViewGuest::Create));
const extensions::Extension* extension = LoadTestExtension();
ASSERT_TRUE(extension);
......
......@@ -226,19 +226,16 @@ void WebViewAPITest::StartTestServer(const std::string& app_location) {
test_data_dir = test_data_dir.AppendASCII(app_location.c_str());
embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
embedded_test_server()->RegisterRequestHandler(
base::Bind(&RedirectResponseHandler,
kRedirectResponsePath,
embedded_test_server()->GetURL(kRedirectResponseFullPath)));
embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
&RedirectResponseHandler, kRedirectResponsePath,
embedded_test_server()->GetURL(kRedirectResponseFullPath)));
embedded_test_server()->RegisterRequestHandler(
base::Bind(&EmptyResponseHandler, kEmptyResponsePath));
base::BindRepeating(&EmptyResponseHandler, kEmptyResponsePath));
embedded_test_server()->RegisterRequestHandler(
base::Bind(
&UserAgentResponseHandler,
kUserAgentRedirectResponsePath,
embedded_test_server()->GetURL(kRedirectResponseFullPath)));
embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
&UserAgentResponseHandler, kUserAgentRedirectResponsePath,
embedded_test_server()->GetURL(kRedirectResponseFullPath)));
net::test_server::RegisterDefaultHandlers(embedded_test_server());
......
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