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(
const ResizeFunction& resize_function) {
std::unique_ptr<ChromeAppIcon> icon = std::make_unique<ChromeAppIcon>(
delegate, context_,
base::Bind(&ChromeAppIconService::OnIconDestroyed,
weak_ptr_factory_.GetWeakPtr()),
base::BindOnce(&ChromeAppIconService::OnIconDestroyed,
weak_ptr_factory_.GetWeakPtr()),
app_id, resource_size_in_dip, resize_function);
icon_map_[icon->app_id()].insert(icon.get());
......
......@@ -36,7 +36,7 @@ class ValidationFunction : public ExtensionFunction {
public:
explicit ValidationFunction(bool should_succeed)
: should_succeed_(should_succeed), did_respond_(false) {
set_response_callback(base::Bind(
set_response_callback(base::BindRepeating(
(should_succeed ? &SuccessCallback : &FailCallback), &did_respond_));
}
......
......@@ -724,7 +724,8 @@ TEST_F(ExtensionContextMenuModelTest, TestPageAccessSubmenu) {
// Pretend the extension wants to run.
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(
extension, UserScript::DOCUMENT_IDLE, increment_run_count);
......
......@@ -346,7 +346,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
extensions::CrxInstaller* installer = NULL;
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE,
base::Bind(&IsCrxInstallerDone, &installer));
base::BindRepeating(&IsCrxInstallerDone, &installer));
extensions::CRXFileInfo crx_info(path, extensions::GetTestVerifierFormat());
crx_info.extension_id = extension->id();
extension_service_->UpdateExtension(crx_info, true, &installer);
......
......@@ -218,8 +218,9 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
ExtensionPrefs::Get(profile_), Blocklist::Get(profile_),
autoupdate_enabled, extensions_enabled, &ready_));
uninstall_ping_sender_.reset(new UninstallPingSender(
ExtensionRegistry::Get(profile_), base::Bind(&ShouldSendUninstallPing)));
uninstall_ping_sender_ = std::make_unique<UninstallPingSender>(
ExtensionRegistry::Get(profile_),
base::BindRepeating(&ShouldSendUninstallPing));
// These services must be registered before the ExtensionService tries to
// load any extensions.
......
......@@ -173,9 +173,8 @@ class ExternalProviderImplTest : public ExtensionServiceTestBase {
ExtensionServiceTestBase::SetUp();
test_server_ = std::make_unique<net::test_server::EmbeddedTestServer>();
test_server_->RegisterRequestHandler(
base::Bind(&ExternalProviderImplTest::HandleRequest,
base::Unretained(this)));
test_server_->RegisterRequestHandler(base::BindRepeating(
&ExternalProviderImplTest::HandleRequest, base::Unretained(this)));
ASSERT_TRUE(test_server_->Start());
test_extension_cache_.reset(new ExtensionCacheFake());
......
......@@ -372,8 +372,8 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, DISABLED_NoCookieIsolationWithoutApp) {
// Tests that subresource and media requests use the app's cookie store.
// See http://crbug.com/141172.
IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) {
embedded_test_server()->RegisterRequestHandler(
base::Bind(&HandleExpectAndSetCookieRequest, embedded_test_server()));
embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
&HandleExpectAndSetCookieRequest, embedded_test_server()));
ASSERT_TRUE(embedded_test_server()->Start());
......
......@@ -99,7 +99,7 @@ class ScriptExecutorBrowserTest : public ExtensionBrowserTest {
content::RenderFrameHost* GetFrameByName(content::WebContents* web_contents,
const std::string& name) {
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