Make ImageLoader's callbacks Once, not Repeating
These ImageLoaderFooBarCallback typedef's were previously
base::Callback, neither explicitly a base::OnceCallback or a
base::RepeatingCallback. Presumably these typedef's were first defined
before there was a base::OnceCB vs base::RepeatingCB distinction.
The general motivation for this commit is that base/callback.h says that
it intends to flip the type alias of base::CB to be base::OnceCB instead
of base::RepeatingCB.
The specific motivation for this commit is to be able to call
ImageLoader::LoadImagesAsync as part of a Mojo IPC call chain. The
mechanism for Mojo method calls to return something is a base::OnceCB.
You can easily use a base::OnceCB to call another base::RepeatingCB
(once), but doing vice versa is trickier, especially if the base::OnceCB
expects to be std::move'd around but base::BindRepeating expects to copy
its arguments.
A very specific motivation is to make the app_icon_factory.h API more
consistent, with its functions all taking the same type of callback, a
base::OnceCB.
Change-Id: Iec560709d97be22e92ccd17a27bad39eab597c6f
Reviewed-on: https://chromium-review.googlesource.com/c/1348875
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Drew Wilson <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Commit-Queue: Nigel Tao <[email protected]>
Cr-Commit-Position: refs/heads/master@{#611973}
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index 8694f7c..4ac6bdc 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -634,11 +634,9 @@
extensions::ImageLoader::ImageRepresentation::NEVER_RESIZE,
gfx::Size(),
ui::SCALE_FACTOR_100P));
- loader->LoadImagesAsync(
- extension_,
- images_list,
- base::Bind(&ExtensionInstallPrompt::OnImageLoaded,
- weak_factory_.GetWeakPtr()));
+ loader->LoadImagesAsync(extension_, images_list,
+ base::BindOnce(&ExtensionInstallPrompt::OnImageLoaded,
+ weak_factory_.GetWeakPtr()));
}
void ExtensionInstallPrompt::ShowConfirmation() {