From 9c02acef44b0ee324291cb3f438f2d034d2d0866 Mon Sep 17 00:00:00 2001 From: Alexander Cooper Date: Mon, 1 Feb 2021 19:38:14 +0000 Subject: [PATCH] [CodeHealth] Update c/b/plugins to modern callback methods Updates base::Bind calls in PluginInfoHostImpl and PluginPrefs to match the corresponding "Repeating" type of the underlying function being called. Updates PluginINfoHostImplUnittest to take a QuitClosure as a OnceClosure to match it's usage. Fixed: 1170970 Change-Id: Ifa23e0150587c74b16deb0141c394fb051fdd975 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2657771 Commit-Queue: Alexander Cooper Reviewed-by: Dirk Pranke Reviewed-by: Tommy Li Cr-Commit-Position: refs/heads/master@{#849210} --- PRESUBMIT.py | 1 - chrome/browser/plugins/plugin_info_host_impl.cc | 4 ++-- chrome/browser/plugins/plugin_info_host_impl_unittest.cc | 4 ++-- chrome/browser/plugins/plugin_prefs.cc | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 886078da5fbdd8..865a58890327d9 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -340,7 +340,6 @@ '^chrome/browser/ntp_tiles/ntp_tiles_browsertest.cc', '^chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer_browsertest.cc', # pylint: disable=line-too-long '^chrome/browser/payments/payment_manifest_parser_browsertest.cc', - '^chrome/browser/plugins/', '^chrome/browser/portal/portal_browsertest.cc', '^chrome/browser/profiling_host/profiling_process_host.cc', '^chrome/browser/recovery/recovery_install_global_error.cc', diff --git a/chrome/browser/plugins/plugin_info_host_impl.cc b/chrome/browser/plugins/plugin_info_host_impl.cc index 2d60fc4a10182d..6de814c6ed1e65 100644 --- a/chrome/browser/plugins/plugin_info_host_impl.cc +++ b/chrome/browser/plugins/plugin_info_host_impl.cc @@ -152,8 +152,8 @@ PluginInfoHostImpl::PluginInfoHostImpl(int render_process_id, Profile* profile) shutdown_subscription_ = PluginInfoHostImplShutdownNotifierFactory::GetInstance() ->Get(profile) - ->Subscribe(base::Bind(&PluginInfoHostImpl::ShutdownOnUIThread, - base::Unretained(this))); + ->Subscribe(base::BindRepeating( + &PluginInfoHostImpl::ShutdownOnUIThread, base::Unretained(this))); } void PluginInfoHostImpl::ShutdownOnUIThread() { diff --git a/chrome/browser/plugins/plugin_info_host_impl_unittest.cc b/chrome/browser/plugins/plugin_info_host_impl_unittest.cc index e127a333dc9d69..e94fee6a575cbc 100644 --- a/chrome/browser/plugins/plugin_info_host_impl_unittest.cc +++ b/chrome/browser/plugins/plugin_info_host_impl_unittest.cc @@ -32,9 +32,9 @@ using testing::Eq; namespace { -void PluginsLoaded(const base::Closure& callback, +void PluginsLoaded(base::OnceClosure callback, const std::vector& plugins) { - callback.Run(); + std::move(callback).Run(); } class FakePluginServiceFilter : public content::PluginServiceFilter { diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc index 5888dba8cbea51..45b86b412772af 100644 --- a/chrome/browser/plugins/plugin_prefs.cc +++ b/chrome/browser/plugins/plugin_prefs.cc @@ -176,8 +176,8 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { UpdatePdfPolicy(prefs::kPluginsAlwaysOpenPdfExternally); registrar_.Init(prefs_); registrar_.Add(prefs::kPluginsAlwaysOpenPdfExternally, - base::Bind(&PluginPrefs::UpdatePdfPolicy, - base::Unretained(this))); + base::BindRepeating(&PluginPrefs::UpdatePdfPolicy, + base::Unretained(this))); } void PluginPrefs::ShutdownOnUIThread() {