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

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

Issue 1173753003: [Media Router] Implement JoinRoute + update CreateRoute API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix again x2 Created 5 years, 6 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 946dd127c6f0f3611cb0eb8e24a4f647660467bb..32807983baa8b3c6bb0b179cce2a4048e1f8a920 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.
@@ -40,11 +43,33 @@ class MediaRouter {
virtual ~MediaRouter() {}
// Creates a media route from |source_id| to |sink_id|.
+ // |origin| is the URL of requestor's page.
+ // |tab_id| is the ID of the tab in which the request was made.
+ // |origin| and |tab_id| are used for enforcing same-origin and/or same-tab
+ // scope for JoinRoute() requests. (e.g., if enforced, the page
+ // requesting JoinRoute() must have the same origin as the page that requested
+ // CreateRoute()).
+ // The caller may pass in|kInvalidTabId| if tab is not applicable.
// |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.
+ // (See CreateRoute documentation).
+ // |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;
« no previous file with comments | « chrome/browser/media/router/create_session_request_unittest.cc ('k') | chrome/browser/media/router/media_router.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698