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 0699d3f86bf8c26371cc08a93a19e59f515572da..f6f89f23b9d4c401860f95670b223081339a9151 100644 |
| --- a/chrome/browser/media/router/media_router.h |
| +++ b/chrome/browser/media/router/media_router.h |
| @@ -29,6 +29,9 @@ class MediaSinksObserver; |
| using MediaRouteResponseCallback = |
| base::Callback<void(scoped_ptr<MediaRoute>, const std::string&)>; |
| +// Used in cases where a tab ID is not applicable in CreateRoute/JoinRoute. |
| +const int kInvalidTabId = -1; |
| + |
| // 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. |
| @@ -38,11 +41,30 @@ class MediaRouter { |
| virtual ~MediaRouter() {} |
| // Creates a media route from |source_id| to |sink_id|. |
| + // |origin| and |tab_id| are used for enforcing same-origin and/or same-tab |
| + // scope, and are optional. |
|
mark a. foltz
2015/06/10 23:18:51
Since this API is for creating a new route, it's a
imcheng (use chromium acct)
2015/06/11 22:49:12
Ok, I added some comments on the values of |origin
|
| + // The caller may pass in empty GURL for |origin| and/or |kInvalidTabId| for |
| + // |tab_id| if not enforcing same-origin and/or same-tab scope. |
|
mark a. foltz
2015/06/10 23:18:51
The caller doesn't know if the provider is going t
imcheng (use chromium acct)
2015/06/11 22:49:12
Good point. We can make them mandatory. I left the
|
| // |callback| is invoked with a response indicating success or failure. |
| virtual void CreateRoute(const MediaSource::Id& source_id, |
| const MediaSink::Id& sink_id, |
| + const GURL& origin, |
| + int tab_id, |
| const MediaRouteResponseCallback& callback) = 0; |
| + // Joins an existing route identified by |presentation_id|. |
| + // |source|: The source to route to the existing route. |
| + // |presentation_id|: Presentation ID of the existing route. |
| + // |origin|, |tab_id|: Origin and tab of the join route request. Used for |
| + // validation when enforcing same-origin and/or same-tab scope, and |
| + // are optional. (See CreateRoute documentation). |
|
mark a. foltz
2015/06/10 23:18:51
Similar comment about mandatory vs optional for or
imcheng (use chromium acct)
2015/06/11 22:49:12
Done.
|
| + // |callback| is invoked with a response indicating success or failure. |
| + virtual void JoinRoute(const MediaSource::Id& source, |
| + const std::string& presentation_id, |
| + const GURL& origin, |
| + int tab_id, |
| + const MediaRouteResponseCallback& callback) = 0; |
| + |
| // Closes the media route specified by |route_id|. |
| virtual void CloseRoute(const MediaRoute::Id& route_id) = 0; |