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

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 DISALLOW_ASSIGN to Observer 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') | no next file with comments »
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..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);
};
« no previous file with comments | « no previous file | ash/system/cast/tray_cast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698