| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 * @return {boolean} | 257 * @return {boolean} |
| 258 */ | 258 */ |
| 259 MediaRouter.prototype.getKeepAlive = function() { | 259 MediaRouter.prototype.getKeepAlive = function() { |
| 260 return this.keepAlive_ != null; | 260 return this.keepAlive_ != null; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 /** | 263 /** |
| 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 {!string} origin |
| 267 * @param {!Array<!MediaSink>} sinks | 268 * @param {!Array<!MediaSink>} sinks |
| 268 */ | 269 */ |
| 269 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks) { | 270 MediaRouter.prototype.onSinksReceived = function( |
| 270 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_)); | 271 sourceUrn, origin, sinks) { |
| 272 if (origin typeof String) { |
| 273 this.service_.onSinksReceived(sourceUrn, origin, sinks.map(sinkToMojo_)); |
| 274 } else { |
| 275 /* Provided for backward compatibility if the component extension was |
| 276 * before cl/114586744 when the parameter list only had two parameters: |
| 277 * |
| 278 * @param {!string} sourceUrn |
| 279 * @param {!Array<!MediaSink>} sinks |
| 280 */ |
| 281 this.service_.onSinksReceived(sourceUrn, "", origin); |
| 282 } |
| 271 }; | 283 }; |
| 272 | 284 |
| 273 /** | 285 /** |
| 274 * Called by the provider manager to keep the extension from suspending | 286 * 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 | 287 * if it enters a state where suspension is undesirable (e.g. there is an |
| 276 * active MediaRoute.) | 288 * active MediaRoute.) |
| 277 * If keepAlive is true, the extension is kept alive. | 289 * If keepAlive is true, the extension is kept alive. |
| 278 * If keepAlive is false, the extension is allowed to suspend. | 290 * If keepAlive is false, the extension is allowed to suspend. |
| 279 * @param {boolean} keepAlive | 291 * @param {boolean} keepAlive |
| 280 */ | 292 */ |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 console.error(nextHandler + ' handler not registered.'); | 535 console.error(nextHandler + ' handler not registered.'); |
| 524 } | 536 } |
| 525 }); | 537 }); |
| 526 } | 538 } |
| 527 | 539 |
| 528 /** | 540 /** |
| 529 * Starts querying for sinks capable of displaying the media source | 541 * Starts querying for sinks capable of displaying the media source |
| 530 * designated by |sourceUrn|. Results are returned by calling | 542 * designated by |sourceUrn|. Results are returned by calling |
| 531 * OnSinksReceived. | 543 * OnSinksReceived. |
| 532 * @param {!string} sourceUrn | 544 * @param {!string} sourceUrn |
| 545 * @param {!string} origin |
| 533 */ | 546 */ |
| 534 MediaRouteProvider.prototype.startObservingMediaSinks = | 547 MediaRouteProvider.prototype.startObservingMediaSinks = |
| 535 function(sourceUrn) { | 548 function(sourceUrn, origin) { |
| 536 this.handlers_.startObservingMediaSinks(sourceUrn); | 549 this.handlers_.startObservingMediaSinks(sourceUrn, origin); |
| 537 }; | 550 }; |
| 538 | 551 |
| 539 /** | 552 /** |
| 540 * Stops querying for sinks capable of displaying |sourceUrn|. | 553 * Stops querying for sinks capable of displaying |sourceUrn|. |
| 541 * @param {!string} sourceUrn | 554 * @param {!string} sourceUrn |
| 555 * @param {!string} origin |
| 542 */ | 556 */ |
| 543 MediaRouteProvider.prototype.stopObservingMediaSinks = | 557 MediaRouteProvider.prototype.stopObservingMediaSinks = |
| 544 function(sourceUrn) { | 558 function(sourceUrn, origin) { |
| 545 this.handlers_.stopObservingMediaSinks(sourceUrn); | 559 this.handlers_.stopObservingMediaSinks(sourceUrn, origin); |
| 546 }; | 560 }; |
| 547 | 561 |
| 548 /** | 562 /** |
| 549 * Requests that |sinkId| render the media referenced by |sourceUrn|. If the | 563 * Requests that |sinkId| render the media referenced by |sourceUrn|. If the |
| 550 * request is from the Presentation API, then origin and tabId will | 564 * request is from the Presentation API, then origin and tabId will |
| 551 * be populated. | 565 * be populated. |
| 552 * @param {!string} sourceUrn Media source to render. | 566 * @param {!string} sourceUrn Media source to render. |
| 553 * @param {!string} sinkId Media sink ID. | 567 * @param {!string} sinkId Media sink ID. |
| 554 * @param {!string} presentationId Presentation ID from the site | 568 * @param {!string} presentationId Presentation ID from the site |
| 555 * requesting presentation. TODO(mfoltz): Remove. | 569 * requesting presentation. TODO(mfoltz): Remove. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 }; | 748 }; |
| 735 | 749 |
| 736 mediaRouter = new MediaRouter(connector.bindHandleToProxy( | 750 mediaRouter = new MediaRouter(connector.bindHandleToProxy( |
| 737 serviceProvider.connectToService( | 751 serviceProvider.connectToService( |
| 738 mediaRouterMojom.MediaRouter.name), | 752 mediaRouterMojom.MediaRouter.name), |
| 739 mediaRouterMojom.MediaRouter)); | 753 mediaRouterMojom.MediaRouter)); |
| 740 | 754 |
| 741 return mediaRouter; | 755 return mediaRouter; |
| 742 }); | 756 }); |
| 743 | 757 |
| OLD | NEW |