Chromium Code Reviews| 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 |