Chromium Code Reviews| Index: chrome/browser/media/router/media_route_provider_manager_host.h |
| diff --git a/chrome/browser/media/router/media_route_provider_manager_host.h b/chrome/browser/media/router/media_route_provider_manager_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..67b14e822011840f26a0149f5287c80b6ae40397 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_route_provider_manager_host.h |
| @@ -0,0 +1,109 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_ |
| +#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/callback.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" |
| + |
| +namespace media_router { |
| + |
| +class MediaRoute; |
| + |
| +// Acts as the Chrome endpoint for communication between Media Router and |
| +// Media Route Providers (via the Media Route Provider Manager). |
| +class MediaRouteProviderManagerHost { |
|
xhwang
2015/04/08 17:46:25
We don't have MediaRouteProvider and MediaRoutePro
imcheng
2015/04/08 19:21:31
Our implementation of MediaRouteProvider and Media
|
| + public: |
| + virtual ~MediaRouteProviderManagerHost() {} |
| + |
| + // Delegate called by the MediaRouteProviderManagerHost when a response is |
| + // received from the MRPM. |
| + class Delegate { |
|
xhwang
2015/04/08 17:46:24
It seems not all methods of this class are respons
imcheng
2015/04/08 19:21:31
I changed the class level comment here. But, since
xhwang
2015/04/08 20:32:51
Ack. Thanks!
imcheng
2015/04/08 23:28:09
Discussed offline. Will merged the interfaces into
|
| + public: |
| + virtual ~Delegate() {} |
| + |
| + // Called when results from a media sinks query have been received. |
| + // |source|: Media source of the query. |
| + // |sinks|: List of sinks compatible with the source. |
| + virtual void OnSinksReceived(const MediaSource& source, |
| + const std::vector<MediaSink>& sinks) = 0; |
| + |
| + // Called when there is a message from a route. |
| + // |route_id|: The route ID. |
| + // |message|: The message. |
| + virtual void OnMessage(const MediaRouteId& route_id, |
| + const std::string& message) = 0; |
| + |
| + // Called when a response to a route request has been received and |
| + // a route has been established. |
| + // |request_id|: ID of original request. |
| + // |route|: Description of the established route. |
| + virtual void OnRouteResponseReceived(const RouteRequestId& request_id, |
| + const MediaRoute& route) = 0; |
| + |
| + // Called when an error occurred while establishing a route. |
| + // |request_id|: ID of original request. |
| + // |error_text|: Text describing the error. |
| + virtual void OnRouteResponseError(const RouteRequestId& request_id, |
| + const std::string& error_text) = 0; |
|
xhwang
2015/04/08 17:46:24
OnRouteResponseReceived() or OnRouteResponseError(
imcheng
2015/04/08 19:21:30
Done.
|
| + |
| + // Called when the list of currently MediaRoutes and their MediaSinks |
|
xhwang
2015/04/08 17:46:24
nit: s/currently/current
imcheng
2015/04/08 19:21:31
Done.
|
| + // has been updated. |
| + // |routes|: List of MediaRoutes. |
| + // |sinks|: List of MediaSinks associated with the routes. |
| + virtual void OnRoutesUpdated(const std::vector<MediaRoute>& routes, |
| + const std::vector<MediaSink>& sinks) = 0; |
|
xhwang
2015/04/08 17:46:24
Ditto. |routes| contains sinks. What's the relatio
imcheng
2015/04/08 19:21:30
Removed |sinks|.
|
| + |
| + // Called when the MRPMHost is being destroyed. |
| + virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0; |
| + }; |
| + |
| + // The following APIs allow the media router to send commands to the MRPM. |
| + |
| + // Instructs MRPM to start a query for compatible media sinks for |source|. |
| + // Results from the query and subsequent updates will be received via |
| + // |Delegate::OnSinksReceived| until the query is removed from MRPM |
| + // via |RemoveMediaSinksQuery|. |
| + virtual void AddMediaSinksQuery(const MediaSource& source) = 0; |
| + |
| + // Instructs MRPM to stop a query for compatible media sinks for |source|. |
| + // The delegate will no longer receive updates. |
| + virtual void RemoveMediaSinksQuery(const MediaSource& source) = 0; |
| + |
| + // Requests MRPM to establish a route between |source| and a media sink given |
| + // by |sink_id|. |request_id| is generated by Media Router and passed |
| + // to MRPM to identify the request. |
| + // Result of the request will be received via either |
| + // |Delegate::OnRouteResponseReceived| or |OnRouteResponseError|. |
| + virtual void RequestRoute(const RouteRequestId& request_id, |
| + const MediaSource& source, |
| + const MediaSinkId& sink_id) = 0; |
|
xhwang
2015/04/08 17:46:24
If you use a callback for the response, you should
imcheng
2015/04/08 19:21:31
See uniformity comment above.
|
| + |
| + // Requests MRPM to close a route specified by |route_id|. |
| + virtual void CloseRoute(const MediaRouteId& route_id) = 0; |
| + |
| + // Requests MRPM to post |message| to a MediaSink connected by MediaRoute |
| + // with |route_id|. |
| + virtual void PostMessage(const MediaRouteId& route_id, |
| + const std::string& message) = 0; |
| + |
| + // Requests MRPM to start a query for all MediaRoutes and their MediaSinks. |
| + // The result and subsequent updates will be received via |
| + // |Delegate::OnRoutesUpdated|. |
|
xhwang
2015/04/08 17:46:24
Please see my comments above on callbacks.
imcheng
2015/04/08 19:21:30
Acknowledged.
|
| + virtual void StartMediaRoutesQuery() = 0; |
| + |
| + // Requests MRPM to stop the query. The delegate will no longer receive |
| + // updates. |
| + virtual void StopMediaRoutesQuery() = 0; |
| +}; |
| + |
| +} // namespace media_router |
| + |
| +#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_ |