| 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..a43f2b3070b03ed7cdfead4c507f93f9607450eb 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);
|
| };
|
|
|
| /**
|
| @@ -373,6 +378,11 @@ define('media_router_bindings', [
|
| * @type {function()}
|
| */
|
| this.stopObservingMediaRoutes = null;
|
| +
|
| + /**
|
| + * @type {function()}
|
| + */
|
| + this.connectRouteByRouteId = null;
|
| };
|
|
|
| /**
|
| @@ -419,7 +429,8 @@ define('media_router_bindings', [
|
| 'joinRoute',
|
| 'createRoute',
|
| 'stopObservingMediaSinks',
|
| - 'startObservingMediaRoutes'
|
| + 'startObservingMediaRoutes',
|
| + 'connectRouteByRouteId'
|
| ];
|
| requiredHandlers.forEach(function(nextHandler) {
|
| if (handlers[nextHandler] === undefined) {
|
| @@ -498,6 +509,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)
|
| + .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 +614,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
|
| */
|
| - MediaRouteProvider.prototype.stopObservingMediaRoutes = function() {
|
| - this.handlers_.stopObservingMediaRoutes();
|
| + MediaRouteProvider.prototype.stopObservingMediaRoutes = function(sourceUrn) {
|
| + this.handlers_.stopObservingMediaRoutes(sourceUrn);
|
| };
|
|
|
| mediaRouter = new MediaRouter(connector.bindHandleToProxy(
|
|
|