Skip to content

Commit

Permalink
[CodeHealth] Update c/b/plugins to modern callback methods
Browse files Browse the repository at this point in the history
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 <alcooper@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849210}
  • Loading branch information
alcooper91 authored and Chromium LUCI CQ committed Feb 1, 2021
1 parent 7b341e0 commit 9c02ace
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/plugins/plugin_info_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/plugins/plugin_info_host_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ using testing::Eq;

namespace {

void PluginsLoaded(const base::Closure& callback,
void PluginsLoaded(base::OnceClosure callback,
const std::vector<content::WebPluginInfo>& plugins) {
callback.Run();
std::move(callback).Run();
}

class FakePluginServiceFilter : public content::PluginServiceFilter {
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/plugins/plugin_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 9c02ace

Please sign in to comment.