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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var mediaRouter; 5 var mediaRouter;
6 6
7 define('media_router_bindings', [ 7 define('media_router_bindings', [
8 'mojo/public/js/bindings', 8 'mojo/public/js/bindings',
9 'mojo/public/js/core', 9 'mojo/public/js/core',
10 'content/public/renderer/service_provider', 10 'content/public/renderer/service_provider',
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 'default_action': issueActionToMojo_(issue.defaultAction), 272 'default_action': issueActionToMojo_(issue.defaultAction),
273 'secondary_actions': secondaryActions, 273 'secondary_actions': secondaryActions,
274 'help_url': issue.helpUrl, 274 'help_url': issue.helpUrl,
275 'is_blocking': issue.isBlocking 275 'is_blocking': issue.isBlocking
276 })); 276 }));
277 }; 277 };
278 278
279 /** 279 /**
280 * Called by the provider manager when the set of active routes 280 * Called by the provider manager when the set of active routes
281 * has been updated. 281 * has been updated.
282 * @param {!string} sourceUrn The sourUrn associated with this route query.
282 * @param {!Array<MediaRoute>} routes The active set of media routes. 283 * @param {!Array<MediaRoute>} routes The active set of media routes.
284 * @param {!Array<string>} joinableRoutes The active set of joinable media
285 * routes.
283 */ 286 */
284 MediaRouter.prototype.onRoutesUpdated = function(routes) { 287 MediaRouter.prototype.onRoutesUpdated =
285 this.service_.onRoutesUpdated(routes.map(routeToMojo_)); 288 function(sourceUrn, routes, joinableRouteIds) {
289 this.service_.onRoutesUpdated(
290 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.
286 }; 291 };
287 292
288 /** 293 /**
289 * Called by the provider manager when sink availability has been updated. 294 * Called by the provider manager when sink availability has been updated.
290 * @param {!mediaRouterMojom.MediaRouter.SinkAvailability} availability 295 * @param {!mediaRouterMojom.MediaRouter.SinkAvailability} availability
291 * The new sink availability. 296 * The new sink availability.
292 */ 297 */
293 MediaRouter.prototype.onSinkAvailabilityUpdated = function(availability) { 298 MediaRouter.prototype.onSinkAvailabilityUpdated = function(availability) {
294 this.service_.onSinkAvailabilityUpdated(availability); 299 this.service_.onSinkAvailabilityUpdated(availability);
295 }; 300 };
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 return this.handlers_.joinRoute(sourceUrn, presentationId, origin, tabId) 496 return this.handlers_.joinRoute(sourceUrn, presentationId, origin, tabId)
492 .then(function(newRoute) { 497 .then(function(newRoute) {
493 return {route: routeToMojo_(newRoute)}; 498 return {route: routeToMojo_(newRoute)};
494 }, 499 },
495 function(err) { 500 function(err) {
496 return {error_text: 'Error joining route: ' + err.message}; 501 return {error_text: 'Error joining route: ' + err.message};
497 }); 502 });
498 }; 503 };
499 504
500 /** 505 /**
506 * Handles a request via the Presentation API to join an existing route given
507 * by |sourceUrn| and |routeId|. |origin| and |tabId| are used for
508 * validating same-origin/tab scope.
509 * @param {!string} sourceUrn Media source to render.
510 * @param {!string} routeId Route ID to join.
511 * @param {!string} presentationId Presentation ID to join.
512 * @param {!string} origin Origin of site requesting join.
513 * @param {!number} tabId ID of tab requesting join.
514 * @return {!Promise.<!Object>} A Promise resolving to an object describing
515 * the newly created media route, or rejecting with an error message on
516 * failure.
517 */
518 MediaRouteProvider.prototype.connectRouteByRouteId =
519 function(sourceUrn, routeId, presentationId, origin, tabId) {
520 return this.handlers_.connectRouteByRouteId(
521 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
522 .then(function(newRoute) {
523 return {route: routeToMojo_(newRoute)};
524 },
525 function(err) {
526 return {error_text: 'Error joining route: ' + err.message};
527 });
528 };
529
530 /**
501 * Closes the route specified by |routeId|. 531 * Closes the route specified by |routeId|.
502 * @param {!string} routeId 532 * @param {!string} routeId
503 */ 533 */
504 MediaRouteProvider.prototype.closeRoute = function(routeId) { 534 MediaRouteProvider.prototype.closeRoute = function(routeId) {
505 this.handlers_.closeRoute(routeId); 535 this.handlers_.closeRoute(routeId);
506 }; 536 };
507 537
508 /** 538 /**
509 * Posts a message to the route designated by |routeId|. 539 * Posts a message to the route designated by |routeId|.
510 * @param {!string} routeId 540 * @param {!string} routeId
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 * @param {!string} routeId 601 * @param {!string} routeId
572 */ 602 */
573 MediaRouteProvider.prototype.onPresentationSessionDetached = function( 603 MediaRouteProvider.prototype.onPresentationSessionDetached = function(
574 routeId) { 604 routeId) {
575 this.handlers_.onPresentationSessionDetached(routeId); 605 this.handlers_.onPresentationSessionDetached(routeId);
576 }; 606 };
577 607
578 /** 608 /**
579 * Requests that the provider manager start sending information about active 609 * Requests that the provider manager start sending information about active
580 * media routes to the Media Router. 610 * media routes to the Media Router.
611 * @param {!string} sourceUrn
581 */ 612 */
582 MediaRouteProvider.prototype.startObservingMediaRoutes = function() { 613 MediaRouteProvider.prototype.startObservingMediaRoutes = function(sourceUrn) {
583 this.handlers_.startObservingMediaRoutes(); 614 this.handlers_.startObservingMediaRoutes(sourceUrn);
584 }; 615 };
585 616
586 /** 617 /**
587 * Requests that the provider manager stop sending information about active 618 * Requests that the provider manager stop sending information about active
588 * media routes to the Media Router. 619 * media routes to the Media Router.
620 * @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
589 */ 621 */
590 MediaRouteProvider.prototype.stopObservingMediaRoutes = function() { 622 MediaRouteProvider.prototype.stopObservingMediaRoutes = function(sourceUrn) {
591 this.handlers_.stopObservingMediaRoutes(); 623 this.handlers_.stopObservingMediaRoutes(sourceUrn);
592 }; 624 };
593 625
594 mediaRouter = new MediaRouter(connector.bindHandleToProxy( 626 mediaRouter = new MediaRouter(connector.bindHandleToProxy(
595 serviceProvider.connectToService( 627 serviceProvider.connectToService(
596 mediaRouterMojom.MediaRouter.name), 628 mediaRouterMojom.MediaRouter.name),
597 mediaRouterMojom.MediaRouter)); 629 mediaRouterMojom.MediaRouter));
598 630
599 return mediaRouter; 631 return mediaRouter;
600 }); 632 });
601 633
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698