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

Unified Diff: ash/cast_config_delegate.h

Issue 1567103005: Replace base::CallbackList with base::ObserverList in CastConfigDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Replace with ObserverList instead of base::Callback 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
« no previous file with comments | « no previous file | ash/system/cast/tray_cast.h » ('j') | ash/system/cast/tray_cast.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/cast_config_delegate.h
diff --git a/ash/cast_config_delegate.h b/ash/cast_config_delegate.h
index 9c1e1c6b379e9e2312bcf3d1497ea8708c992480..dd6be59dfa058412a1d103b6afdcce93f8dcc8ea 100644
--- a/ash/cast_config_delegate.h
+++ b/ash/cast_config_delegate.h
@@ -10,7 +10,6 @@
#include "ash/ash_export.h"
#include "base/callback.h"
-#include "base/callback_list.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
@@ -71,12 +70,13 @@ class CastConfigDelegate {
Activity activity;
};
- // The key is the receiver id.
using ReceiversAndActivities = std::vector<ReceiverAndActivity>;
- using ReceiversAndActivitesCallback =
- base::Callback<void(const ReceiversAndActivities&)>;
- using DeviceUpdateSubscription = scoped_ptr<
- base::CallbackList<void(const ReceiversAndActivities&)>::Subscription>;
+
+ class Observer {
+ public:
+ // Invoked whenever there is new receiver or activity information available.
+ virtual void OnDevicesUpdated(const ReceiversAndActivities& devices);
+ };
stevenjb 2016/01/12 23:31:49 Typically an observer class with only one or two m
jdufault 2016/01/12 23:59:22 Done.
virtual ~CastConfigDelegate() {}
@@ -85,10 +85,9 @@ class CastConfigDelegate {
// gone. See crbug.com/551132.
virtual bool HasCastExtension() const = 0;
- // Adds a listener that will get invoked whenever the receivers or their
- // associated activites have changed.
- virtual DeviceUpdateSubscription RegisterDeviceUpdateObserver(
- const ReceiversAndActivitesCallback& callback) = 0;
+ // Add or remove an observer.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
// Request fresh data from the backend. When the data is available, all
// registered observers will get called.
« no previous file with comments | « no previous file | ash/system/cast/tray_cast.h » ('j') | ash/system/cast/tray_cast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698