Chromium Code Reviews| Index: ash/cast_config_delegate.h |
| diff --git a/ash/cast_config_delegate.h b/ash/cast_config_delegate.h |
| index 9c1e1c6b379e9e2312bcf3d1497ea8708c992480..5a45ad601b82448ac753690390ca108e6d0d81f6 100644 |
| --- a/ash/cast_config_delegate.h |
| +++ b/ash/cast_config_delegate.h |
| @@ -9,8 +9,6 @@ |
| #include <vector> |
| #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 +69,19 @@ 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 ASH_EXPORT Observer { |
| + public: |
| + // Invoked whenever there is new receiver or activity information available. |
| + virtual void OnDevicesUpdated(const ReceiversAndActivities& devices) = 0; |
| + |
| + protected: |
| + virtual ~Observer() {} |
| + |
| + private: |
| + DISALLOW_ASSIGN(Observer); |
|
achuithb
2016/01/13 22:05:44
Isn't DISALLOW_COPY_AND_ASSIGN better here?
jdufault
2016/01/13 22:12:14
That causes a compilation error, with it you need
achuithb
2016/01/13 22:19:27
Acknowledged.
|
| + }; |
| virtual ~CastConfigDelegate() {} |
| @@ -85,11 +90,6 @@ 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; |
| - |
| // Request fresh data from the backend. When the data is available, all |
| // registered observers will get called. |
| virtual void RequestDeviceRefresh() = 0; |
| @@ -111,6 +111,10 @@ class CastConfigDelegate { |
| // gone. See crbug.com/551132. |
| virtual void LaunchCastOptions() = 0; |
| + // Add or remove an observer. |
| + virtual void AddObserver(Observer* observer) = 0; |
| + virtual void RemoveObserver(Observer* observer) = 0; |
| + |
| private: |
| DISALLOW_ASSIGN(CastConfigDelegate); |
| }; |