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..d5eb6e9591f7bf60beccb8185470862237f9f570 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" |
|
achuithb
2016/01/13 09:21:25
Do you need this?
jdufault
2016/01/13 19:43:26
Done.
|
| -#include "base/callback_list.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/strings/string16.h" |
| @@ -71,12 +70,15 @@ 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: |
| + virtual ~Observer() {} |
|
achuithb
2016/01/13 09:21:25
I think this can be protected?
jdufault
2016/01/13 19:43:26
Needs to be public so the extension API can call O
stevenjb
2016/01/13 20:02:18
OnDevicesUpdated should be public, but the destruc
achuithb
2016/01/13 21:08:33
Yup, sorry I wasn't clear.
|
| + |
| + // Invoked whenever there is new receiver or activity information available. |
| + virtual void OnDevicesUpdated(const ReceiversAndActivities& devices) = 0; |
| + }; |
|
achuithb
2016/01/13 09:21:25
DISALLOW_COPY_AND_ASSIGN perhaps?
jdufault
2016/01/13 19:43:26
Doing so also requires defining a default construc
stevenjb
2016/01/13 20:02:18
It shouldn't. This is the preferred pattern:
clas
achuithb
2016/01/13 21:08:33
+1. Thanks for clarifying, Steven
jdufault
2016/01/13 22:02:23
Done.
|
| virtual ~CastConfigDelegate() {} |
| @@ -85,10 +87,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. |
|
achuithb
2016/01/13 09:21:25
I feel like these administrative functions should
jdufault
2016/01/13 19:43:26
Done.
|
| + 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. |