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

Unified Diff: extensions/renderer/resources/media_router_bindings.js

Issue 1415103006: Non-Local Join for Media Router and Presentation API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Fixes 3 * WITH UI Changes Created 5 years 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: extensions/renderer/resources/media_router_bindings.js
diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js
index 7bf09d3bf9ab598f5fdd89024c20877802727f60..19a946198e963865a3f1eaeda0d171e7c532aff7 100644
--- a/extensions/renderer/resources/media_router_bindings.js
+++ b/extensions/renderer/resources/media_router_bindings.js
@@ -279,10 +279,15 @@ define('media_router_bindings', [
/**
* Called by the provider manager when the set of active routes
* has been updated.
+ * @param {!string} sourceUrn The sourUrn associated with this route query.
* @param {!Array<MediaRoute>} routes The active set of media routes.
+ * @param {!Array<string>} joinableRoutes The active set of joinable media
+ * routes.
*/
- MediaRouter.prototype.onRoutesUpdated = function(routes) {
- this.service_.onRoutesUpdated(routes.map(routeToMojo_));
+ MediaRouter.prototype.onRoutesUpdated =
+ function(sourceUrn, routes, joinableRouteIds) {
+ this.service_.onRoutesUpdated(
+ sourceUrn, routes.map(routeToMojo_), joinableRouteIds);
imcheng 2015/12/29 00:24:42 You can make this backwards compatible if you chec
matt.boetger 2016/01/05 00:19:48 Done.
};
/**
@@ -498,6 +503,31 @@ define('media_router_bindings', [
};
/**
+ * Handles a request via the Presentation API to join an existing route given
+ * by |sourceUrn| and |routeId|. |origin| and |tabId| are used for
+ * validating same-origin/tab scope.
+ * @param {!string} sourceUrn Media source to render.
+ * @param {!string} routeId Route ID to join.
+ * @param {!string} presentationId Presentation ID to join.
+ * @param {!string} origin Origin of site requesting join.
+ * @param {!number} tabId ID of tab requesting join.
+ * @return {!Promise.<!Object>} A Promise resolving to an object describing
+ * the newly created media route, or rejecting with an error message on
+ * failure.
+ */
+ MediaRouteProvider.prototype.connectRouteByRouteId =
+ function(sourceUrn, routeId, presentationId, origin, tabId) {
+ return this.handlers_.connectRouteByRouteId(
+ sourceUrn, routeId, presentationId, origin, tabId)
apacible 2015/12/18 22:34:19 nit: fix indentation for L521-527.
matt.boetger 2015/12/18 23:37:15 I fixed the parameter list indentation - not sure
+ .then(function(newRoute) {
+ return {route: routeToMojo_(newRoute)};
+ },
+ function(err) {
+ return {error_text: 'Error joining route: ' + err.message};
+ });
+ };
+
+ /**
* Closes the route specified by |routeId|.
* @param {!string} routeId
*/
@@ -578,17 +608,19 @@ define('media_router_bindings', [
/**
* Requests that the provider manager start sending information about active
* media routes to the Media Router.
+ * @param {!string} sourceUrn
*/
- MediaRouteProvider.prototype.startObservingMediaRoutes = function() {
- this.handlers_.startObservingMediaRoutes();
+ MediaRouteProvider.prototype.startObservingMediaRoutes = function(sourceUrn) {
+ this.handlers_.startObservingMediaRoutes(sourceUrn);
};
/**
* Requests that the provider manager stop sending information about active
* media routes to the Media Router.
+ * @param {!string} sourceUrn
mark a. foltz 2015/12/16 07:17:35 Adding a new required parameter is specifically no
matt.boetger 2015/12/18 23:37:15 The changes to onRouteUpdated also means that the
imcheng 2015/12/29 00:24:42 It should be able to make this change backwards co
matt.boetger 2016/01/05 00:19:48 In order to make this backwards compatible, I need
*/
- MediaRouteProvider.prototype.stopObservingMediaRoutes = function() {
- this.handlers_.stopObservingMediaRoutes();
+ MediaRouteProvider.prototype.stopObservingMediaRoutes = function(sourceUrn) {
+ this.handlers_.stopObservingMediaRoutes(sourceUrn);
};
mediaRouter = new MediaRouter(connector.bindHandleToProxy(

Powered by Google App Engine
This is Rietveld 408576698