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