Commit 402b61dd authored by Yi Gu's avatar Yi Gu Committed by Chromium LUCI CQ

[CodeHealth] Convert c/b//extensions from base::Bind and base::Callback to Once/Repeating

Bug: 1152282
Change-Id: Ida2eab986d80bb02bf83c1bdad506fa5485495ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595596Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837793}
parent 3fd7020a
...@@ -44,8 +44,8 @@ std::unique_ptr<ChromeAppIcon> ChromeAppIconService::CreateIcon( ...@@ -44,8 +44,8 @@ std::unique_ptr<ChromeAppIcon> ChromeAppIconService::CreateIcon(
const ResizeFunction& resize_function) { const ResizeFunction& resize_function) {
std::unique_ptr<ChromeAppIcon> icon = std::make_unique<ChromeAppIcon>( std::unique_ptr<ChromeAppIcon> icon = std::make_unique<ChromeAppIcon>(
delegate, context_, delegate, context_,
base::Bind(&ChromeAppIconService::OnIconDestroyed, base::BindOnce(&ChromeAppIconService::OnIconDestroyed,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
app_id, resource_size_in_dip, resize_function); app_id, resource_size_in_dip, resize_function);
icon_map_[icon->app_id()].insert(icon.get()); icon_map_[icon->app_id()].insert(icon.get());
......
...@@ -36,7 +36,7 @@ class ValidationFunction : public ExtensionFunction { ...@@ -36,7 +36,7 @@ class ValidationFunction : public ExtensionFunction {
public: public:
explicit ValidationFunction(bool should_succeed) explicit ValidationFunction(bool should_succeed)
: should_succeed_(should_succeed), did_respond_(false) { : should_succeed_(should_succeed), did_respond_(false) {
set_response_callback(base::Bind( set_response_callback(base::BindRepeating(
(should_succeed ? &SuccessCallback : &FailCallback), &did_respond_)); (should_succeed ? &SuccessCallback : &FailCallback), &did_respond_));
} }
......
...@@ -724,7 +724,8 @@ TEST_F(ExtensionContextMenuModelTest, TestPageAccessSubmenu) { ...@@ -724,7 +724,8 @@ TEST_F(ExtensionContextMenuModelTest, TestPageAccessSubmenu) {
// Pretend the extension wants to run. // Pretend the extension wants to run.
int run_count = 0; int run_count = 0;
base::Closure increment_run_count(base::Bind(&Increment, &run_count)); base::RepeatingClosure increment_run_count(
base::BindRepeating(&Increment, &run_count));
action_runner->RequestScriptInjectionForTesting( action_runner->RequestScriptInjectionForTesting(
extension, UserScript::DOCUMENT_IDLE, increment_run_count); extension, UserScript::DOCUMENT_IDLE, increment_run_count);
......
...@@ -346,7 +346,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test { ...@@ -346,7 +346,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
extensions::CrxInstaller* installer = NULL; extensions::CrxInstaller* installer = NULL;
content::WindowedNotificationObserver observer( content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE, extensions::NOTIFICATION_CRX_INSTALLER_DONE,
base::Bind(&IsCrxInstallerDone, &installer)); base::BindRepeating(&IsCrxInstallerDone, &installer));
extensions::CRXFileInfo crx_info(path, extensions::GetTestVerifierFormat()); extensions::CRXFileInfo crx_info(path, extensions::GetTestVerifierFormat());
crx_info.extension_id = extension->id(); crx_info.extension_id = extension->id();
extension_service_->UpdateExtension(crx_info, true, &installer); extension_service_->UpdateExtension(crx_info, true, &installer);
......
...@@ -218,8 +218,9 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { ...@@ -218,8 +218,9 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
ExtensionPrefs::Get(profile_), Blocklist::Get(profile_), ExtensionPrefs::Get(profile_), Blocklist::Get(profile_),
autoupdate_enabled, extensions_enabled, &ready_)); autoupdate_enabled, extensions_enabled, &ready_));
uninstall_ping_sender_.reset(new UninstallPingSender( uninstall_ping_sender_ = std::make_unique<UninstallPingSender>(
ExtensionRegistry::Get(profile_), base::Bind(&ShouldSendUninstallPing))); ExtensionRegistry::Get(profile_),
base::BindRepeating(&ShouldSendUninstallPing));
// These services must be registered before the ExtensionService tries to // These services must be registered before the ExtensionService tries to
// load any extensions. // load any extensions.
......
...@@ -173,9 +173,8 @@ class ExternalProviderImplTest : public ExtensionServiceTestBase { ...@@ -173,9 +173,8 @@ class ExternalProviderImplTest : public ExtensionServiceTestBase {
ExtensionServiceTestBase::SetUp(); ExtensionServiceTestBase::SetUp();
test_server_ = std::make_unique<net::test_server::EmbeddedTestServer>(); test_server_ = std::make_unique<net::test_server::EmbeddedTestServer>();
test_server_->RegisterRequestHandler( test_server_->RegisterRequestHandler(base::BindRepeating(
base::Bind(&ExternalProviderImplTest::HandleRequest, &ExternalProviderImplTest::HandleRequest, base::Unretained(this)));
base::Unretained(this)));
ASSERT_TRUE(test_server_->Start()); ASSERT_TRUE(test_server_->Start());
test_extension_cache_.reset(new ExtensionCacheFake()); test_extension_cache_.reset(new ExtensionCacheFake());
......
...@@ -372,8 +372,8 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) { ...@@ -372,8 +372,8 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) {
// Tests that subresource and media requests use the app's cookie store. // Tests that subresource and media requests use the app's cookie store.
// See http://crbug.com/141172. // See http://crbug.com/141172.
IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) {
embedded_test_server()->RegisterRequestHandler( embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
base::Bind(&HandleExpectAndSetCookieRequest, embedded_test_server())); &HandleExpectAndSetCookieRequest, embedded_test_server()));
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
......
...@@ -99,7 +99,7 @@ class ScriptExecutorBrowserTest : public ExtensionBrowserTest { ...@@ -99,7 +99,7 @@ class ScriptExecutorBrowserTest : public ExtensionBrowserTest {
content::RenderFrameHost* GetFrameByName(content::WebContents* web_contents, content::RenderFrameHost* GetFrameByName(content::WebContents* web_contents,
const std::string& name) { const std::string& name) {
return content::FrameMatchingPredicate( return content::FrameMatchingPredicate(
web_contents, base::Bind(&content::FrameMatchesName, name)); web_contents, base::BindRepeating(&content::FrameMatchesName, name));
} }
}; };
......
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