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

Unified Diff: chrome/browser/media/router/media_router.h

Issue 1430413003: [Media Router] Connection state change listening redesign part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix content_unittests compile Created 5 years, 1 month 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/browser/media/router/media_router.h
diff --git a/chrome/browser/media/router/media_router.h b/chrome/browser/media/router/media_router.h
index ed6cf1e80db026287f3c698092ef9c1517c8e089..14086bf4d0a1aae7ab8cf83dc7e978af71f36e93 100644
--- a/chrome/browser/media/router/media_router.h
+++ b/chrome/browser/media/router/media_router.h
@@ -9,12 +9,14 @@
#include <vector>
#include "base/callback.h"
+#include "base/callback_list.h"
#include "base/memory/scoped_vector.h"
#include "chrome/browser/media/router/issue.h"
#include "chrome/browser/media/router/media_route.h"
#include "chrome/browser/media/router/media_sink.h"
#include "chrome/browser/media/router/media_source.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "content/public/browser/presentation_service_delegate.h"
#include "content/public/browser/presentation_session_message.h"
namespace content {
@@ -48,6 +50,12 @@ using MediaRouteResponseCallback =
const std::string& presentation_id,
const std::string& error)>;
+// Subscription object returned by calling
+// |AddPresentationConnectionStateChangedCallback|. See the method comments for
+// details.
+using PresentationConnectionStateSubscription = base::CallbackList<void(
+ content::PresentationConnectionState)>::Subscription;
+
// An interface for handling resources related to media routing.
// Responsible for registering observers for receiving sink availability
// updates, handling route requests/responses, and operating on routes (e.g.
@@ -122,6 +130,14 @@ class MediaRouter : public KeyedService {
// route.
virtual bool HasLocalDisplayRoute() const = 0;
+ // Adds |callback| to listen for state changes for presentation connected to
+ // |route_id|. Callback will be invoked whenever there are state changes,
+ // until the returned Subscription object is destroyed.
+ virtual scoped_ptr<PresentationConnectionStateSubscription>
+ AddPresentationConnectionStateChangedCallback(
+ const MediaRoute::Id& route_id,
+ const content::PresentationConnectionStateChangedCallback& callback) = 0;
+
private:
friend class IssuesObserver;
friend class LocalMediaRoutesObserver;
@@ -192,15 +208,6 @@ class MediaRouter : public KeyedService {
// Removes the LocalMediaRoutesObserver |observer|.
virtual void UnregisterLocalMediaRoutesObserver(
LocalMediaRoutesObserver* observer) = 0;
-
- // Registers/unregisters a PresentationConnectionStateObserver to receive
- // updates on state changes for a PresentationConnection. MediaRouter does
- // not own |observer|. When |observer| is about to be destroyed, it must be
- // unregistered from MediaRouter.
- virtual void RegisterPresentationConnectionStateObserver(
- PresentationConnectionStateObserver* observer) = 0;
- virtual void UnregisterPresentationConnectionStateObserver(
- PresentationConnectionStateObserver* observer) = 0;
};
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698