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

Side by Side Diff: extensions/renderer/resources/media_router_bindings.js

Issue 1507743005: [MediaRouter] Renames CloseRoute() to Terminate() and creates DetachRoute() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 this.createRoute = null; 319 this.createRoute = null;
320 320
321 /** 321 /**
322 * @type {function(!string, !string, !string, !number)} 322 * @type {function(!string, !string, !string, !number)}
323 */ 323 */
324 this.joinRoute = null; 324 this.joinRoute = null;
325 325
326 /** 326 /**
327 * @type {function(string)} 327 * @type {function(string)}
328 */ 328 */
329 this.closeRoute = null; 329 this.terminateRoute = null;
330 330
331 /** 331 /**
332 * @type {function(string)} 332 * @type {function(string)}
333 */ 333 */
334 this.startObservingMediaSinks = null; 334 this.startObservingMediaSinks = null;
335 335
336 /** 336 /**
337 * @type {function(string)} 337 * @type {function(string)}
338 */ 338 */
339 this.stopObservingMediaSinks = null; 339 this.stopObservingMediaSinks = null;
(...skipping 15 matching lines...) Expand all
355 this.listenForRouteMessages = null; 355 this.listenForRouteMessages = null;
356 356
357 /** 357 /**
358 * @type {function(string)} 358 * @type {function(string)}
359 */ 359 */
360 this.stopListeningForRouteMessages = null; 360 this.stopListeningForRouteMessages = null;
361 361
362 /** 362 /**
363 * @type {function(string)} 363 * @type {function(string)}
364 */ 364 */
365 this.onPresentationSessionDetached = null; 365 this.detachRoute = null;
366 366
367 /** 367 /**
368 * @type {function()} 368 * @type {function()}
369 */ 369 */
370 this.startObservingMediaRoutes = null; 370 this.startObservingMediaRoutes = null;
371 371
372 /** 372 /**
373 * @type {function()} 373 * @type {function()}
374 */ 374 */
375 this.stopObservingMediaRoutes = null; 375 this.stopObservingMediaRoutes = null;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 */ 407 */
408 MediaRouteProvider.prototype.setHandlers = function(handlers) { 408 MediaRouteProvider.prototype.setHandlers = function(handlers) {
409 this.handlers_ = handlers; 409 this.handlers_ = handlers;
410 var requiredHandlers = [ 410 var requiredHandlers = [
411 'stopObservingMediaRoutes', 411 'stopObservingMediaRoutes',
412 'startObservingMediaRoutes', 412 'startObservingMediaRoutes',
413 'sendRouteMessage', 413 'sendRouteMessage',
414 'sendRouteBinaryMessage', 414 'sendRouteBinaryMessage',
415 'listenForRouteMessages', 415 'listenForRouteMessages',
416 'stopListeningForRouteMessages', 416 'stopListeningForRouteMessages',
417 'onPresentationSessionDetached', 417 'detachRoute',
418 'closeRoute', 418 'terminateRoute',
419 'joinRoute', 419 'joinRoute',
420 'createRoute', 420 'createRoute',
421 'stopObservingMediaSinks', 421 'stopObservingMediaSinks',
422 'startObservingMediaRoutes' 422 'startObservingMediaRoutes'
423 ]; 423 ];
424 requiredHandlers.forEach(function(nextHandler) { 424 requiredHandlers.forEach(function(nextHandler) {
425 if (handlers[nextHandler] === undefined) { 425 if (handlers[nextHandler] === undefined) {
426 console.error(nextHandler + ' handler not registered.'); 426 console.error(nextHandler + ' handler not registered.');
427 } 427 }
428 }); 428 });
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 return this.handlers_.joinRoute(sourceUrn, presentationId, origin, tabId) 491 return this.handlers_.joinRoute(sourceUrn, presentationId, origin, tabId)
492 .then(function(newRoute) { 492 .then(function(newRoute) {
493 return {route: routeToMojo_(newRoute)}; 493 return {route: routeToMojo_(newRoute)};
494 }, 494 },
495 function(err) { 495 function(err) {
496 return {error_text: 'Error joining route: ' + err.message}; 496 return {error_text: 'Error joining route: ' + err.message};
497 }); 497 });
498 }; 498 };
499 499
500 /** 500 /**
501 * Closes the route specified by |routeId|. 501 * Terminates the route specified by |routeId|.
502 * @param {!string} routeId 502 * @param {!string} routeId
503 */ 503 */
504 MediaRouteProvider.prototype.closeRoute = function(routeId) { 504 MediaRouteProvider.prototype.terminateRoute = function(routeId) {
505 this.handlers_.closeRoute(routeId); 505 this.handlers_.terminateRoute(routeId);
506 }; 506 };
507 507
508 /** 508 /**
509 * Posts a message to the route designated by |routeId|. 509 * Posts a message to the route designated by |routeId|.
510 * @param {!string} routeId 510 * @param {!string} routeId
511 * @param {!string} message 511 * @param {!string} message
512 * @return {!Promise.<boolean>} Resolved with true if the message was sent, 512 * @return {!Promise.<boolean>} Resolved with true if the message was sent,
513 * or false on failure. 513 * or false on failure.
514 */ 514 */
515 MediaRouteProvider.prototype.sendRouteMessage = function( 515 MediaRouteProvider.prototype.sendRouteMessage = function(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 * If there is an outstanding |listenForRouteMessages| promise for 559 * If there is an outstanding |listenForRouteMessages| promise for
560 * |routeId|, resolve that promise with an empty array. 560 * |routeId|, resolve that promise with an empty array.
561 * @param {!string} routeId 561 * @param {!string} routeId
562 */ 562 */
563 MediaRouteProvider.prototype.stopListeningForRouteMessages = function( 563 MediaRouteProvider.prototype.stopListeningForRouteMessages = function(
564 routeId) { 564 routeId) {
565 return this.handlers_.stopListeningForRouteMessages(routeId); 565 return this.handlers_.stopListeningForRouteMessages(routeId);
566 }; 566 };
567 567
568 /** 568 /**
569 * Indicates that the presentation session that was connected to |routeId| is 569 * Indicates that the presentation connection that was connected to |routeId|
570 * no longer connected to it. 570 * is no longer connected to it.
571 * @param {!string} routeId 571 * @param {!string} routeId
572 */ 572 */
573 MediaRouteProvider.prototype.onPresentationSessionDetached = function( 573 MediaRouteProvider.prototype.detachRoute = function(
574 routeId) { 574 routeId) {
575 this.handlers_.onPresentationSessionDetached(routeId); 575 this.handlers_.detachRoute(routeId);
576 }; 576 };
577 577
578 /** 578 /**
579 * Requests that the provider manager start sending information about active 579 * Requests that the provider manager start sending information about active
580 * media routes to the Media Router. 580 * media routes to the Media Router.
581 */ 581 */
582 MediaRouteProvider.prototype.startObservingMediaRoutes = function() { 582 MediaRouteProvider.prototype.startObservingMediaRoutes = function() {
583 this.handlers_.startObservingMediaRoutes(); 583 this.handlers_.startObservingMediaRoutes();
584 }; 584 };
585 585
586 /** 586 /**
587 * Requests that the provider manager stop sending information about active 587 * Requests that the provider manager stop sending information about active
588 * media routes to the Media Router. 588 * media routes to the Media Router.
589 */ 589 */
590 MediaRouteProvider.prototype.stopObservingMediaRoutes = function() { 590 MediaRouteProvider.prototype.stopObservingMediaRoutes = function() {
591 this.handlers_.stopObservingMediaRoutes(); 591 this.handlers_.stopObservingMediaRoutes();
592 }; 592 };
593 593
594 mediaRouter = new MediaRouter(connector.bindHandleToProxy( 594 mediaRouter = new MediaRouter(connector.bindHandleToProxy(
595 serviceProvider.connectToService( 595 serviceProvider.connectToService(
596 mediaRouterMojom.MediaRouter.name), 596 mediaRouterMojom.MediaRouter.name),
597 mediaRouterMojom.MediaRouter)); 597 mediaRouterMojom.MediaRouter));
598 598
599 return mediaRouter; 599 return mediaRouter;
600 }); 600 });
601 601
OLDNEW
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698