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

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: Add DLL export to fix windows build 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.h » ('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..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.
« no previous file with comments | « no previous file | ash/system/cast/tray_cast.h » ('j') | ash/system/cast/tray_cast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698