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

Unified Diff: chrome/common/media_router/discovery/media_sink_service.h

Issue 2965843002: [Media Router] Support dual discovery (Closed)
Patch Set: clean up and fix unit tests Created 3 years, 5 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
Index: chrome/common/media_router/discovery/media_sink_service.h
diff --git a/chrome/common/media_router/discovery/media_sink_service.h b/chrome/common/media_router/discovery/media_sink_service.h
index 0fb11b5b8e5e659a02edbef26d2a63c0b5a46396..e510f005d0a68775accd9ab98f82ebec2a95c1d3 100644
--- a/chrome/common/media_router/discovery/media_sink_service.h
+++ b/chrome/common/media_router/discovery/media_sink_service.h
@@ -21,6 +21,15 @@ namespace media_router {
// This class is not thread safe. All methods must be called from the UI thread.
class MediaSinkService {
public:
+ class Observer {
+ public:
+ // Invoked when |sink| is added to current service.
+ virtual void OnMediaSinkAdded(const MediaSinkInternal& sink) = 0;
+
+ // Invoked when media sinks are removed from current service.
+ virtual void OnMediaSinksRemoved() = 0;
+ };
+
// Callback to be invoked when this class finishes sink discovering.
// Arg 0: Sinks discovered and resolved by the service.
using OnSinksDiscoveredCallback =
@@ -39,6 +48,14 @@ class MediaSinkService {
// Stops sink discovery. No-ops if already stopped.
virtual void Stop() = 0;
+ // Adds |observer| to current service. Does not take ownership of |observer|.
+ // Caller should make sure that |observer| outlives current service.
+ virtual void AddObserver(Observer* observer) = 0;
+
+ // Removes |observer| from current service. Does not take ownership of
+ // |observer|.
+ virtual void RemoveObserver(Observer* observer) = 0;
+
protected:
OnSinksDiscoveredCallback sink_discovery_callback_;

Powered by Google App Engine
This is Rietveld 408576698