Commit 0624c5b2 authored by David Bokan's avatar David Bokan Committed by Chromium LUCI CQ

Convert UpdateClientFactory to RepeatingCallback

TestExtensionsBrowserClient allows passing a factory callback that can
be used to create UpdateClients. By nature of being a factory, this
should be a repeating callback. We also pass it by value to indicate a
transfer of ownership.

No change to (the only) call site as it already uses BindRepeating.

Bug: 1152268
Change-Id: Ib07a63a48614fe3bb52b8fc060dd3946f64ec42f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605874Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840910}
parent 7f1cb5cc
...@@ -35,8 +35,8 @@ TestExtensionsBrowserClient::TestExtensionsBrowserClient() ...@@ -35,8 +35,8 @@ TestExtensionsBrowserClient::TestExtensionsBrowserClient()
TestExtensionsBrowserClient::~TestExtensionsBrowserClient() = default; TestExtensionsBrowserClient::~TestExtensionsBrowserClient() = default;
void TestExtensionsBrowserClient::SetUpdateClientFactory( void TestExtensionsBrowserClient::SetUpdateClientFactory(
const base::Callback<update_client::UpdateClient*(void)>& factory) { base::RepeatingCallback<update_client::UpdateClient*(void)> factory) {
update_client_factory_ = factory; update_client_factory_ = std::move(factory);
} }
void TestExtensionsBrowserClient::SetMainContext( void TestExtensionsBrowserClient::SetMainContext(
......
...@@ -55,7 +55,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { ...@@ -55,7 +55,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
// Sets a factory to respond to calls of the CreateUpdateClient method. // Sets a factory to respond to calls of the CreateUpdateClient method.
void SetUpdateClientFactory( void SetUpdateClientFactory(
const base::Callback<update_client::UpdateClient*(void)>& factory); base::RepeatingCallback<update_client::UpdateClient*(void)> factory);
// Sets the main browser context. Only call if a BrowserContext was not // Sets the main browser context. Only call if a BrowserContext was not
// already provided. |main_context| must not be an incognito context. // already provided. |main_context| must not be an incognito context.
...@@ -168,7 +168,8 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { ...@@ -168,7 +168,8 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
std::unique_ptr<ExtensionCache> extension_cache_; std::unique_ptr<ExtensionCache> extension_cache_;
base::Callback<update_client::UpdateClient*(void)> update_client_factory_; base::RepeatingCallback<update_client::UpdateClient*(void)>
update_client_factory_;
}; };
} // namespace extensions } // namespace extensions
......
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