Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h

Issue 1567103005: Replace base::CallbackList with base::ObserverList in CastConfigDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Add TODO for proper fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
diff --git a/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h b/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
index 7f4da06c64c332cb563e8ee2cf26122a83abccd0..ab64a4aa2778a7954b7e4ccb7f81790c066553ee 100644
--- a/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
+++ b/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
@@ -10,6 +10,7 @@
#include "ash/cast_config_delegate.h"
#include "base/callback_list.h"
#include "base/macros.h"
+#include "base/observer_list.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
@@ -20,13 +21,12 @@ class CastDeviceUpdateListeners : public BrowserContextKeyedAPI {
explicit CastDeviceUpdateListeners(content::BrowserContext* context);
~CastDeviceUpdateListeners() override;
- // Fetch an instance for the given context.
+ // Fetches an instance for the given context.
static CastDeviceUpdateListeners* Get(content::BrowserContext* context);
- // Register a function that will be invoked only when a new device update is
- // available.
- ash::CastConfigDelegate::DeviceUpdateSubscription RegisterCallback(
- const ash::CastConfigDelegate::ReceiversAndActivitesCallback& callback);
+ // Adds an observer that will be invoked when new device data is available.
+ void AddObserver(ash::CastConfigDelegate::Observer* observer);
+ void RemoveObserver(ash::CastConfigDelegate::Observer* observer);
// BrowserContextKeyedAPI implementation:
static BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>*
@@ -40,7 +40,7 @@ class CastDeviceUpdateListeners : public BrowserContextKeyedAPI {
friend class CastDevicesPrivateUpdateDevicesFunction; // For NotifyCallbacks.
void NotifyCallbacks(const ReceiverAndActivityList& devices);
- base::CallbackList<void(const ReceiverAndActivityList&)> callback_list_;
+ base::ObserverList<ash::CastConfigDelegate::Observer> observer_list_;
friend class BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>;
« no previous file with comments | « ash/test/tray_cast_test_api.cc ('k') | chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698