| OLD | NEW |
| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 * Called by the provider manager when a sink list for a given source is | 264 * Called by the provider manager when a sink list for a given source is |
| 265 * updated. | 265 * updated. |
| 266 * @param {!string} sourceUrn | 266 * @param {!string} sourceUrn |
| 267 * @param {!Array<!MediaSink>} sinks | 267 * @param {!Array<!MediaSink>} sinks |
| 268 */ | 268 */ |
| 269 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks) { | 269 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks) { |
| 270 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_)); | 270 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_)); |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 /** | 273 /** |
| 274 * Called by the provider manager when all sinks matching |sinkId| have been |
| 275 * found. |
| 276 * @param {!string} sinkId |
| 277 * @param {!Array<!MediaSink>} sinks |
| 278 */ |
| 279 MediaRouter.prototype.onSearchSinksReceived = function(sinkId, sinks) { |
| 280 this.service_.onSearchSinksReceived(sinkId, sinks.map(sinkToMojo_)); |
| 281 }; |
| 282 |
| 283 /** |
| 274 * Called by the provider manager to keep the extension from suspending | 284 * Called by the provider manager to keep the extension from suspending |
| 275 * if it enters a state where suspension is undesirable (e.g. there is an | 285 * if it enters a state where suspension is undesirable (e.g. there is an |
| 276 * active MediaRoute.) | 286 * active MediaRoute.) |
| 277 * If keepAlive is true, the extension is kept alive. | 287 * If keepAlive is true, the extension is kept alive. |
| 278 * If keepAlive is false, the extension is allowed to suspend. | 288 * If keepAlive is false, the extension is allowed to suspend. |
| 279 * @param {boolean} keepAlive | 289 * @param {boolean} keepAlive |
| 280 */ | 290 */ |
| 281 MediaRouter.prototype.setKeepAlive = function(keepAlive) { | 291 MediaRouter.prototype.setKeepAlive = function(keepAlive) { |
| 282 if (keepAlive === false && this.keepAlive_) { | 292 if (keepAlive === false && this.keepAlive_) { |
| 283 this.keepAlive_.close(); | 293 this.keepAlive_.close(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 472 |
| 463 /** | 473 /** |
| 464 * @type {function()} | 474 * @type {function()} |
| 465 */ | 475 */ |
| 466 this.stopObservingMediaRoutes = null; | 476 this.stopObservingMediaRoutes = null; |
| 467 | 477 |
| 468 /** | 478 /** |
| 469 * @type {function()} | 479 * @type {function()} |
| 470 */ | 480 */ |
| 471 this.connectRouteByRouteId = null; | 481 this.connectRouteByRouteId = null; |
| 482 |
| 483 /** |
| 484 * @type {function(string, string)} |
| 485 */ |
| 486 this.searchProviders = null; |
| 472 }; | 487 }; |
| 473 | 488 |
| 474 /** | 489 /** |
| 475 * Routes calls from Media Router to the provider manager extension. | 490 * Routes calls from Media Router to the provider manager extension. |
| 476 * Registered with the MediaRouter stub. | 491 * Registered with the MediaRouter stub. |
| 477 * @param {!MediaRouter} MediaRouter proxy to call into the | 492 * @param {!MediaRouter} MediaRouter proxy to call into the |
| 478 * Media Router mojo interface. | 493 * Media Router mojo interface. |
| 479 * @constructor | 494 * @constructor |
| 480 */ | 495 */ |
| 481 function MediaRouteProvider(mediaRouter) { | 496 function MediaRouteProvider(mediaRouter) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 509 'sendRouteMessage', | 524 'sendRouteMessage', |
| 510 'sendRouteBinaryMessage', | 525 'sendRouteBinaryMessage', |
| 511 'listenForRouteMessages', | 526 'listenForRouteMessages', |
| 512 'stopListeningForRouteMessages', | 527 'stopListeningForRouteMessages', |
| 513 'detachRoute', | 528 'detachRoute', |
| 514 'terminateRoute', | 529 'terminateRoute', |
| 515 'joinRoute', | 530 'joinRoute', |
| 516 'createRoute', | 531 'createRoute', |
| 517 'stopObservingMediaSinks', | 532 'stopObservingMediaSinks', |
| 518 'startObservingMediaRoutes', | 533 'startObservingMediaRoutes', |
| 519 'connectRouteByRouteId' | 534 'connectRouteByRouteId', |
| 535 'searchProviders', |
| 520 ]; | 536 ]; |
| 521 requiredHandlers.forEach(function(nextHandler) { | 537 requiredHandlers.forEach(function(nextHandler) { |
| 522 if (handlers[nextHandler] === undefined) { | 538 if (handlers[nextHandler] === undefined) { |
| 523 console.error(nextHandler + ' handler not registered.'); | 539 console.error(nextHandler + ' handler not registered.'); |
| 524 } | 540 } |
| 525 }); | 541 }); |
| 526 } | 542 } |
| 527 | 543 |
| 528 /** | 544 /** |
| 529 * Starts querying for sinks capable of displaying the media source | 545 * Starts querying for sinks capable of displaying the media source |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 742 |
| 727 /** | 743 /** |
| 728 * Requests that the provider manager stop sending information about active | 744 * Requests that the provider manager stop sending information about active |
| 729 * media routes to the Media Router. | 745 * media routes to the Media Router. |
| 730 * @param {!string} sourceUrn | 746 * @param {!string} sourceUrn |
| 731 */ | 747 */ |
| 732 MediaRouteProvider.prototype.stopObservingMediaRoutes = function(sourceUrn) { | 748 MediaRouteProvider.prototype.stopObservingMediaRoutes = function(sourceUrn) { |
| 733 this.handlers_.stopObservingMediaRoutes(sourceUrn); | 749 this.handlers_.stopObservingMediaRoutes(sourceUrn); |
| 734 }; | 750 }; |
| 735 | 751 |
| 752 /** |
| 753 * Requests that the provider manager search its providers for a sink with id |
| 754 * |sinkId| that is compatible with |sourceUrn|. |
| 755 * @param {string} sourceUrn Media source to be used with the sink. |
| 756 * @param {string} sinkId Sink ID to search for. |
| 757 */ |
| 758 MediaRouteProvider.prototype.searchProviders = function(sourceUrn, sinkId) { |
| 759 this.handlers_.searchProviders(sourceUrn, sinkId); |
| 760 }; |
| 761 |
| 736 mediaRouter = new MediaRouter(connector.bindHandleToProxy( | 762 mediaRouter = new MediaRouter(connector.bindHandleToProxy( |
| 737 serviceProvider.connectToService( | 763 serviceProvider.connectToService( |
| 738 mediaRouterMojom.MediaRouter.name), | 764 mediaRouterMojom.MediaRouter.name), |
| 739 mediaRouterMojom.MediaRouter)); | 765 mediaRouterMojom.MediaRouter)); |
| 740 | 766 |
| 741 return mediaRouter; | 767 return mediaRouter; |
| 742 }); | 768 }); |
| 743 | 769 |
| OLD | NEW |