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

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

Issue 1259073004: [Presentation API] Change ListenForSessionMessages API to client-style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 5 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/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 7912cd5f10ce7067b410a277366eb3294b001831..c0523a4d507512a0f320f911475cb66ac59af344 100644
--- a/chrome/browser/media/router/media_router.h
+++ b/chrome/browser/media/router/media_router.h
@@ -21,15 +21,19 @@ namespace media_router {
class IssuesObserver;
class MediaRoutesObserver;
class MediaSinksObserver;
+class PresentationSessionMessagesObserver;
// Type of callback used in |CreateRoute()|. Callback is invoked when the
// route request either succeeded or failed.
-// The first argument is the route created. If the route request failed, this
+// |route|: The route created. If the route request failed, this
// will be a nullptr.
-// The second argument is the error string, which will be nonempty if the route
-// request failed.
+// |presentation_id|: The presentation ID of the route created, or empty string
haibinlu 2015/07/30 23:59:11 make it clear that this is MR generated unique ID.
imcheng 2015/08/03 18:56:33 Done.
+// if request failed.
+// |error|: nonempty if the route request failed.
using MediaRouteResponseCallback =
- base::Callback<void(const MediaRoute*, const std::string&)>;
+ base::Callback<void(const MediaRoute* route,
+ const std::string& presentation_id,
+ const std::string& error)>;
// Used in cases where a tab ID is not applicable in CreateRoute/JoinRoute.
const int kInvalidTabId = -1;
@@ -88,14 +92,6 @@ class MediaRouter : public KeyedService {
const std::string& message,
const SendRouteMessageCallback& callback) = 0;
- // Gets the next batch of messages from one of the routes in |route_ids|.
- // |message_cb|: Invoked with a non-empty list of messages when there are
- // messages, an empty list when messaging channel had error.
- // It is not invoked until there are messages available or error.
- virtual void ListenForRouteMessages(
- const std::vector<MediaRoute::Id>& route_ids,
- const PresentationSessionMessageCallback& message_cb) = 0;
-
// Clears the issue with the id |issue_id|.
virtual void ClearIssue(const Issue::Id& issue_id) = 0;
@@ -103,9 +99,9 @@ class MediaRouter : public KeyedService {
friend class IssuesObserver;
friend class MediaSinksObserver;
friend class MediaRoutesObserver;
+ friend class PresentationSessionMessagesObserver;
- // The following functions are called by IssuesObserver, MediaSinksObserver,
- // and MediaRoutesObserver.
+ // The following functions are called by friend Observer classes above.
// Registers |observer| with this MediaRouter. |observer| specifies a media
// source and will receive updates with media sinks that are compatible with
@@ -125,7 +121,7 @@ class MediaRouter : public KeyedService {
// Adds a MediaRoutesObserver to listen for updates on MediaRoutes.
// The initial update may happen synchronously.
- // MediaRouter does not own |observer|. |RemoveMediaRoutesObserver| should
+ // MediaRouter does not own |observer|. |UnregisterMediaRoutesObserver| should
// be called before |observer| is destroyed.
// It is invalid to register the same observer more than once and will result
// in undefined behavior.
@@ -142,6 +138,20 @@ class MediaRouter : public KeyedService {
// Removes the IssuesObserver |observer|.
virtual void UnregisterIssuesObserver(IssuesObserver* observer) = 0;
+
+ // Registers |observer| with this MediaRouter. |observer| specifies a media
+ // route corresponding to a presentation and will receive messages from the
+ // MediaSink connected to the route. Note that MediaRouter does not own
+ // |observer|. |observer| should be unregistered before it is destroyed.
+ // Registering the same observer more than once will result in undefined
+ // behavior.
+ virtual void RegisterPresentationSessionMessagesObserver(
+ PresentationSessionMessagesObserver* observer) = 0;
+
+ // Unregisters a previously registered PresentationSessionMessagesObserver.
+ // |observer| will stop receiving further updates.
+ virtual void UnregisterPresentationSessionMessagesObserver(
+ PresentationSessionMessagesObserver* observer) = 0;
};
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698