Commit 11c507a4 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Convert various uses of "callback list" to base::CallbackList.

This ensures these places also use the most specific naming schemes
possible.

Bug: 1113007
Change-Id: I87800caf53c214410a0bd1d3a04064019ac09404
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343777
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarOrin Jaworski <orinj@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarJohn Wu <jzw@chromium.org>
Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798759}
parent 653c668b
......@@ -81,7 +81,7 @@ struct AccessibilityStatusEventDetails {
};
using AccessibilityStatusCallbackList =
base::CallbackList<void(const AccessibilityStatusEventDetails&)>;
base::RepeatingCallbackList<void(const AccessibilityStatusEventDetails&)>;
using AccessibilityStatusCallback =
AccessibilityStatusCallbackList::CallbackType;
using AccessibilityStatusSubscription =
......
......@@ -33,7 +33,7 @@ namespace chromeos {
class AutoEnrollmentController {
public:
using ProgressCallbackList =
base::CallbackList<void(policy::AutoEnrollmentState)>;
base::RepeatingCallbackList<void(policy::AutoEnrollmentState)>;
// Parameter values for the kEnterpriseEnableForcedReEnrollment flag.
static const char kForcedReEnrollmentAlways[];
......
......@@ -25,7 +25,7 @@ namespace policy {
// register callbacks to invoke when the state keys change.
class ServerBackedStateKeysBroker {
public:
using UpdateCallbackList = base::CallbackList<void()>;
using UpdateCallbackList = base::RepeatingClosureList;
using UpdateCallback = UpdateCallbackList::CallbackType;
using Subscription = std::unique_ptr<UpdateCallbackList::Subscription>;
using StateKeysCallbackList =
......
......@@ -54,14 +54,14 @@ class LazySafeBrowsingDatabaseManager {
database_changed_callback_list_.Notify();
}
std::unique_ptr<base::CallbackList<void()>::Subscription>
std::unique_ptr<base::RepeatingClosureList::Subscription>
RegisterDatabaseChangedCallback(const base::RepeatingClosure& cb) {
return database_changed_callback_list_.Add(cb);
}
private:
scoped_refptr<SafeBrowsingDatabaseManager> instance_;
base::CallbackList<void()> database_changed_callback_list_;
base::RepeatingClosureList database_changed_callback_list_;
};
static base::LazyInstance<LazySafeBrowsingDatabaseManager>::DestructorAtExit
......@@ -75,14 +75,15 @@ class SafeBrowsingClientImpl
: public SafeBrowsingDatabaseManager::Client,
public base::RefCountedThreadSafe<SafeBrowsingClientImpl> {
public:
using OnResultCallback = base::Callback<void(const std::set<std::string>&)>;
using OnResultCallback =
base::OnceCallback<void(const std::set<std::string>&)>;
// Constructs a client to query the database manager for |extension_ids| and
// run |callback| with the IDs of those which have been blocklisted.
static void Start(const std::set<std::string>& extension_ids,
const OnResultCallback& callback) {
OnResultCallback callback) {
auto safe_browsing_client = base::WrapRefCounted(
new SafeBrowsingClientImpl(extension_ids, callback));
new SafeBrowsingClientImpl(extension_ids, std::move(callback)));
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&SafeBrowsingClientImpl::StartCheck,
......@@ -94,9 +95,9 @@ class SafeBrowsingClientImpl
friend class base::RefCountedThreadSafe<SafeBrowsingClientImpl>;
SafeBrowsingClientImpl(const std::set<std::string>& extension_ids,
const OnResultCallback& callback)
OnResultCallback callback)
: callback_task_runner_(base::ThreadTaskRunnerHandle::Get()),
callback_(callback) {}
callback_(std::move(callback)) {}
~SafeBrowsingClientImpl() override {}
......@@ -108,7 +109,8 @@ class SafeBrowsingClientImpl
if (database_manager->CheckExtensionIDs(extension_ids, this)) {
// Definitely not blocklisted. Callback immediately.
callback_task_runner_->PostTask(
FROM_HERE, base::BindOnce(callback_, std::set<std::string>()));
FROM_HERE,
base::BindOnce(std::move(callback_), std::set<std::string>()));
return;
}
// Something might be blocklisted, response will come in
......@@ -118,7 +120,8 @@ class SafeBrowsingClientImpl
void OnCheckExtensionsResult(const std::set<std::string>& hits) override {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
callback_task_runner_->PostTask(FROM_HERE, base::BindOnce(callback_, hits));
callback_task_runner_->PostTask(FROM_HERE,
base::BindOnce(std::move(callback_), hits));
Release(); // Balanced in StartCheck.
}
......
......@@ -139,9 +139,9 @@ class Blocklist : public KeyedService, public base::SupportsWeakPtr<Blocklist> {
base::ObserverList<Observer>::Unchecked observers_;
std::unique_ptr<base::CallbackList<void()>::Subscription>
std::unique_ptr<base::RepeatingClosureList::Subscription>
database_updated_subscription_;
std::unique_ptr<base::CallbackList<void()>::Subscription>
std::unique_ptr<base::RepeatingClosureList::Subscription>
database_changed_subscription_;
// The cached BlocklistState's, received from BlocklistStateFetcher.
......
......@@ -37,9 +37,9 @@ class DialMediaSinkServiceImpl : public MediaSinkServiceBase,
// |app_name|: app name, e.g. YouTube.
// TODO(imcheng): Move sink query logic into DialAppDiscoveryService and
// have it use MediaSinkServiceBase::Observer to observe sinks.
using SinkQueryByAppFunc = void(const std::string& app_name);
using SinkQueryByAppCallback = base::RepeatingCallback<SinkQueryByAppFunc>;
using SinkQueryByAppCallbackList = base::CallbackList<SinkQueryByAppFunc>;
using SinkQueryByAppCallbackList =
base::RepeatingCallbackList<void(const std::string&)>;
using SinkQueryByAppCallback = SinkQueryByAppCallbackList::CallbackType;
using SinkQueryByAppSubscription =
std::unique_ptr<SinkQueryByAppCallbackList::Subscription>;
......
......@@ -111,8 +111,8 @@ typedef base::RepeatingCallback<void(DownloadCheckResult)>
// been formed for a download, or when one has not been formed for a supported
// download.
using ClientDownloadRequestCallbackList =
base::CallbackList<void(download::DownloadItem*,
const ClientDownloadRequest*)>;
base::RepeatingCallbackList<void(download::DownloadItem*,
const ClientDownloadRequest*)>;
using ClientDownloadRequestCallback =
ClientDownloadRequestCallbackList::CallbackType;
using ClientDownloadRequestSubscription =
......@@ -121,7 +121,7 @@ using ClientDownloadRequestSubscription =
// Callbacks run on the main thread when a NativeFileSystemWriteRequest has been
// formed for a write operation.
using NativeFileSystemWriteRequestCallbackList =
base::CallbackList<void(const ClientDownloadRequest*)>;
base::RepeatingCallbackList<void(const ClientDownloadRequest*)>;
using NativeFileSystemWriteRequestCallback =
NativeFileSystemWriteRequestCallbackList::CallbackType;
using NativeFileSystemWriteRequestSubscription =
......@@ -130,7 +130,7 @@ using NativeFileSystemWriteRequestSubscription =
// Callbacks run on the main thread when a PPAPI ClientDownloadRequest has been
// formed for a download.
using PPAPIDownloadRequestCallbackList =
base::CallbackList<void(const ClientDownloadRequest*)>;
base::RepeatingCallbackList<void(const ClientDownloadRequest*)>;
using PPAPIDownloadRequestCallback =
PPAPIDownloadRequestCallbackList::CallbackType;
using PPAPIDownloadRequestSubscription =
......
......@@ -283,7 +283,7 @@ class MockCustomLinksManager : public CustomLinksManager {
MOCK_METHOD1(DeleteLink, bool(const GURL& url));
MOCK_METHOD0(UndoAction, bool());
MOCK_METHOD1(RegisterCallbackForOnChanged,
std::unique_ptr<base::CallbackList<void()>::Subscription>(
std::unique_ptr<base::RepeatingClosureList::Subscription>(
base::RepeatingClosure callback));
};
......@@ -528,7 +528,7 @@ class MostVisitedSitesTest
void EnableCustomLinks() { is_custom_links_enabled_ = true; }
bool is_custom_links_enabled_ = false;
base::CallbackList<SuggestionsService::ResponseCallback::RunType>
base::RepeatingCallbackList<SuggestionsService::ResponseCallback::RunType>
suggestions_service_callbacks_;
TopSitesCallbackList top_sites_callbacks_;
......
......@@ -24,7 +24,8 @@ struct OmniboxLog;
// forwards the event to its registered observers.
class OmniboxEventGlobalTracker {
public:
using OnURLOpenedCallbackList = base::CallbackList<void(OmniboxLog*)>;
using OnURLOpenedCallbackList =
base::RepeatingCallbackList<void(OmniboxLog*)>;
using OnURLOpenedCallback = OnURLOpenedCallbackList::CallbackType;
// Returns the instance of OmniboxEventGlobalTracker.
......
......@@ -138,7 +138,7 @@ void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
v4_get_hash_protocol_manager_.reset();
}
std::unique_ptr<base::CallbackList<void()>::Subscription>
std::unique_ptr<base::RepeatingClosureList::Subscription>
SafeBrowsingDatabaseManager::RegisterDatabaseUpdatedCallback(
const OnDatabaseUpdated& cb) {
return update_complete_callback_list_.Add(cb);
......
......@@ -260,7 +260,7 @@ class SafeBrowsingDatabaseManager
// when it's loaded from disk at startup, and then periodically. These
// callbacks will be on the UI thread.
using OnDatabaseUpdated = base::RepeatingClosure;
std::unique_ptr<base::CallbackList<void()>::Subscription>
std::unique_ptr<base::RepeatingClosureList::Subscription>
RegisterDatabaseUpdatedCallback(const OnDatabaseUpdated& cb);
// Called to stop or shutdown operations on the io_thread. All subclasses
......@@ -338,7 +338,7 @@ class SafeBrowsingDatabaseManager
std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_;
// A list of parties to be notified about database updates.
base::CallbackList<void()> update_complete_callback_list_;
base::RepeatingClosureList update_complete_callback_list_;
private:
// Returns an iterator to the pending API check with the given |client|.
......
......@@ -56,7 +56,7 @@ class TranslateLanguageList {
void SetResourceRequestsAllowed(bool allowed);
using EventCallbackList =
base::CallbackList<void(const TranslateEventDetails&)>;
base::RepeatingCallbackList<void(const TranslateEventDetails&)>;
using EventCallback = EventCallbackList::CallbackType;
// Registers a callback for translate events related to the language list,
......
......@@ -140,12 +140,12 @@ class TranslateManager {
// Callback types for translate errors.
using TranslateErrorCallbackList =
base::CallbackList<void(const TranslateErrorDetails&)>;
base::RepeatingCallbackList<void(const TranslateErrorDetails&)>;
using TranslateErrorCallback = TranslateErrorCallbackList::CallbackType;
// Callback types for translate initialization.
using TranslateInitCallbackList =
base::CallbackList<void(const TranslateInitDetails&)>;
base::RepeatingCallbackList<void(const TranslateInitDetails&)>;
using TranslateInitCallback = TranslateInitCallbackList::CallbackType;
// Registers a callback for translate errors.
......
......@@ -358,7 +358,7 @@ class KeychainTrustSettingsChangedNotifier {
// Must be called on the network notification thread. |callback| will be run
// on the network notification thread. The returned Subscription must be
// destroyed on the network notification thread.
static std::unique_ptr<base::CallbackList<void()>::Subscription> AddCallback(
static std::unique_ptr<base::RepeatingClosureList::Subscription> AddCallback(
base::RepeatingClosure callback) {
DCHECK(GetNetworkNotificationThreadMac()->RunsTasksInCurrentSequence());
return Get()->callback_list_.Add(std::move(callback));
......@@ -392,7 +392,7 @@ class KeychainTrustSettingsChangedNotifier {
return notifier.get();
}
base::CallbackList<void()> callback_list_;
base::RepeatingClosureList callback_list_;
DISALLOW_COPY_AND_ASSIGN(KeychainTrustSettingsChangedNotifier);
};
......@@ -430,7 +430,7 @@ class KeychainTrustObserver {
void Increment() { base::subtle::Barrier_AtomicIncrement(&iteration_, 1); }
// Only accessed on the notification thread.
std::unique_ptr<base::CallbackList<void()>::Subscription> subscription_;
std::unique_ptr<base::RepeatingClosureList::Subscription> subscription_;
base::subtle::Atomic64 iteration_ = 0;
......
......@@ -46,7 +46,7 @@ class HostListService {
std::string localized_description;
};
using CallbackSubscription = base::CallbackList<void()>::Subscription;
using CallbackSubscription = base::RepeatingClosureList::Subscription;
// Returns the singleton instance.
static HostListService* GetInstance();
......@@ -101,8 +101,8 @@ class HostListService {
id user_update_observer_;
base::CallbackList<void()> host_list_state_callbacks_;
base::CallbackList<void()> fetch_failure_callbacks_;
base::RepeatingClosureList host_list_state_callbacks_;
base::RepeatingClosureList fetch_failure_callbacks_;
base::SequenceBound<DirectoryServiceClient> directory_client_;
......
......@@ -23,7 +23,7 @@ namespace ui {
// Central controller to handle touch UI modes.
class COMPONENT_EXPORT(UI_BASE) TouchUiController {
public:
using CallbackList = base::CallbackList<void()>;
using CallbackList = base::RepeatingClosureList;
using Subscription = CallbackList::Subscription;
enum class TouchUiState {
......
......@@ -127,7 +127,7 @@ struct VIEWS_EXPORT ViewHierarchyChangedDetails {
// Used to identify the CallbackList<> within the PropertyChangedVectors map.
using PropertyKey = const void*;
using PropertyChangedCallbacks = base::CallbackList<void()>;
using PropertyChangedCallbacks = base::RepeatingClosureList;
using PropertyChangedCallback = PropertyChangedCallbacks::CallbackType;
using PropertyChangedSubscription =
std::unique_ptr<PropertyChangedCallbacks::Subscription>;
......
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