| 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 'content/public/renderer/frame_interfaces', | 8 'content/public/renderer/frame_interfaces', |
| 9 'chrome/browser/media/router/mojo/media_controller.mojom', | 9 'chrome/browser/media/router/mojo/media_controller.mojom', |
| 10 'chrome/browser/media/router/mojo/media_router.mojom', | 10 'chrome/browser/media/router/mojo/media_router.mojom', |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 DialMediaSink: mediaRouterMojom.DialMediaSink, | 280 DialMediaSink: mediaRouterMojom.DialMediaSink, |
| 281 CastMediaSink: mediaRouterMojom.CastMediaSink, | 281 CastMediaSink: mediaRouterMojom.CastMediaSink, |
| 282 IPAddress: ipAddressMojom.IPAddress, | 282 IPAddress: ipAddressMojom.IPAddress, |
| 283 InterfacePtrController: bindings.InterfacePtrController, | 283 InterfacePtrController: bindings.InterfacePtrController, |
| 284 InterfaceRequest: bindings.InterfaceRequest, | 284 InterfaceRequest: bindings.InterfaceRequest, |
| 285 MediaController: mediaControllerMojom.MediaController, | 285 MediaController: mediaControllerMojom.MediaController, |
| 286 MediaStatus: mediaStatusMojom.MediaStatus, | 286 MediaStatus: mediaStatusMojom.MediaStatus, |
| 287 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, | 287 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, |
| 288 Sink: mediaRouterMojom.MediaSink, | 288 Sink: mediaRouterMojom.MediaSink, |
| 289 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, | 289 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, |
| 290 TimeDelta: timeMojom.TimeDelta, |
| 290 Url: urlMojom.Url, | 291 Url: urlMojom.Url, |
| 291 }; | 292 }; |
| 292 }; | 293 }; |
| 293 | 294 |
| 294 /** | 295 /** |
| 295 * Registers the Media Router Provider Manager with the Media Router. | 296 * Registers the Media Router Provider Manager with the Media Router. |
| 296 * @return {!Promise<string>} Instance ID for the Media Router. | 297 * @return {!Promise<string>} Instance ID for the Media Router. |
| 297 */ | 298 */ |
| 298 MediaRouter.prototype.start = function() { | 299 MediaRouter.prototype.start = function() { |
| 299 return this.service_.registerMediaRouteProvider( | 300 return this.service_.registerMediaRouteProvider( |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 /** | 655 /** |
| 655 * Requests that |sinkId| render the media referenced by |sourceUrn|. If the | 656 * Requests that |sinkId| render the media referenced by |sourceUrn|. If the |
| 656 * request is from the Presentation API, then origin and tabId will | 657 * request is from the Presentation API, then origin and tabId will |
| 657 * be populated. | 658 * be populated. |
| 658 * @param {!string} sourceUrn Media source to render. | 659 * @param {!string} sourceUrn Media source to render. |
| 659 * @param {!string} sinkId Media sink ID. | 660 * @param {!string} sinkId Media sink ID. |
| 660 * @param {!string} presentationId Presentation ID from the site | 661 * @param {!string} presentationId Presentation ID from the site |
| 661 * requesting presentation. TODO(mfoltz): Remove. | 662 * requesting presentation. TODO(mfoltz): Remove. |
| 662 * @param {!originMojom.Origin} origin Origin of site requesting presentation. | 663 * @param {!originMojom.Origin} origin Origin of site requesting presentation. |
| 663 * @param {!number} tabId ID of tab requesting presentation. | 664 * @param {!number} tabId ID of tab requesting presentation. |
| 664 * @param {!TimeDelta} timeout If positive, the timeout duration for the | 665 * @param {!timeMojom.TimeDelta} timeout If positive, the timeout duration for |
| 665 * request. Otherwise, the default duration will be used. | 666 * the request. Otherwise, the default duration will be used. |
| 666 * @param {!boolean} incognito If true, the route is being requested by | 667 * @param {!boolean} incognito If true, the route is being requested by |
| 667 * an incognito profile. | 668 * an incognito profile. |
| 668 * @return {!Promise.<!Object>} A Promise resolving to an object describing | 669 * @return {!Promise.<!Object>} A Promise resolving to an object describing |
| 669 * the newly created media route, or rejecting with an error message on | 670 * the newly created media route, or rejecting with an error message on |
| 670 * failure. | 671 * failure. |
| 671 */ | 672 */ |
| 672 MediaRouteProvider.prototype.createRoute = | 673 MediaRouteProvider.prototype.createRoute = |
| 673 function(sourceUrn, sinkId, presentationId, origin, tabId, | 674 function(sourceUrn, sinkId, presentationId, origin, tabId, |
| 674 timeout, incognito) { | 675 timeout, incognito) { |
| 675 this.handlers_.onBeforeInvokeHandler(); | 676 this.handlers_.onBeforeInvokeHandler(); |
| 676 return this.handlers_.createRoute( | 677 return this.handlers_.createRoute( |
| 677 sourceUrn, sinkId, presentationId, mojoOriginToString_(origin), tabId, | 678 sourceUrn, sinkId, presentationId, mojoOriginToString_(origin), tabId, |
| 678 Math.floor(timeout.microseconds / 1000), incognito) | 679 Math.floor(timeout.microseconds / 1000), incognito) |
| 679 .then(function(route) { | 680 .then(function(route) { |
| 680 return toSuccessRouteResponse_(route); | 681 return toSuccessRouteResponse_(route); |
| 681 }, | 682 }, |
| 682 function(err) { | 683 function(err) { |
| 683 return toErrorRouteResponse_(err); | 684 return toErrorRouteResponse_(err); |
| 684 }); | 685 }); |
| 685 }; | 686 }; |
| 686 | 687 |
| 687 /** | 688 /** |
| 688 * Handles a request via the Presentation API to join an existing route given | 689 * Handles a request via the Presentation API to join an existing route given |
| 689 * by |sourceUrn| and |presentationId|. |origin| and |tabId| are used for | 690 * by |sourceUrn| and |presentationId|. |origin| and |tabId| are used for |
| 690 * validating same-origin/tab scope. | 691 * validating same-origin/tab scope. |
| 691 * @param {!string} sourceUrn Media source to render. | 692 * @param {!string} sourceUrn Media source to render. |
| 692 * @param {!string} presentationId Presentation ID to join. | 693 * @param {!string} presentationId Presentation ID to join. |
| 693 * @param {!originMojom.Origin} origin Origin of site requesting join. | 694 * @param {!originMojom.Origin} origin Origin of site requesting join. |
| 694 * @param {!number} tabId ID of tab requesting join. | 695 * @param {!number} tabId ID of tab requesting join. |
| 695 * @param {!TimeDelta} timeout If positive, the timeout duration for the | 696 * @param {!timeMojom.TimeDelta} timeout If positive, the timeout duration for |
| 696 * request. Otherwise, the default duration will be used. | 697 * the request. Otherwise, the default duration will be used. |
| 697 * @param {!boolean} incognito If true, the route is being requested by | 698 * @param {!boolean} incognito If true, the route is being requested by |
| 698 * an incognito profile. | 699 * an incognito profile. |
| 699 * @return {!Promise.<!Object>} A Promise resolving to an object describing | 700 * @return {!Promise.<!Object>} A Promise resolving to an object describing |
| 700 * the newly created media route, or rejecting with an error message on | 701 * the newly created media route, or rejecting with an error message on |
| 701 * failure. | 702 * failure. |
| 702 */ | 703 */ |
| 703 MediaRouteProvider.prototype.joinRoute = | 704 MediaRouteProvider.prototype.joinRoute = |
| 704 function(sourceUrn, presentationId, origin, tabId, timeout, | 705 function(sourceUrn, presentationId, origin, tabId, timeout, |
| 705 incognito) { | 706 incognito) { |
| 706 this.handlers_.onBeforeInvokeHandler(); | 707 this.handlers_.onBeforeInvokeHandler(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 717 | 718 |
| 718 /** | 719 /** |
| 719 * Handles a request via the Presentation API to join an existing route given | 720 * Handles a request via the Presentation API to join an existing route given |
| 720 * by |sourceUrn| and |routeId|. |origin| and |tabId| are used for | 721 * by |sourceUrn| and |routeId|. |origin| and |tabId| are used for |
| 721 * validating same-origin/tab scope. | 722 * validating same-origin/tab scope. |
| 722 * @param {!string} sourceUrn Media source to render. | 723 * @param {!string} sourceUrn Media source to render. |
| 723 * @param {!string} routeId Route ID to join. | 724 * @param {!string} routeId Route ID to join. |
| 724 * @param {!string} presentationId Presentation ID to join. | 725 * @param {!string} presentationId Presentation ID to join. |
| 725 * @param {!originMojom.Origin} origin Origin of site requesting join. | 726 * @param {!originMojom.Origin} origin Origin of site requesting join. |
| 726 * @param {!number} tabId ID of tab requesting join. | 727 * @param {!number} tabId ID of tab requesting join. |
| 727 * @param {!TimeDelta} timeout If positive, the timeout duration for the | 728 * @param {!timeMojom.TimeDelta} timeout If positive, the timeout duration for |
| 728 * request. Otherwise, the default duration will be used. | 729 * the request. Otherwise, the default duration will be used. |
| 729 * @param {!boolean} incognito If true, the route is being requested by | 730 * @param {!boolean} incognito If true, the route is being requested by |
| 730 * an incognito profile. | 731 * an incognito profile. |
| 731 * @return {!Promise.<!Object>} A Promise resolving to an object describing | 732 * @return {!Promise.<!Object>} A Promise resolving to an object describing |
| 732 * the newly created media route, or rejecting with an error message on | 733 * the newly created media route, or rejecting with an error message on |
| 733 * failure. | 734 * failure. |
| 734 */ | 735 */ |
| 735 MediaRouteProvider.prototype.connectRouteByRouteId = | 736 MediaRouteProvider.prototype.connectRouteByRouteId = |
| 736 function(sourceUrn, routeId, presentationId, origin, tabId, | 737 function(sourceUrn, routeId, presentationId, origin, tabId, |
| 737 timeout, incognito) { | 738 timeout, incognito) { |
| 738 this.handlers_.onBeforeInvokeHandler(); | 739 this.handlers_.onBeforeInvokeHandler(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 } | 937 } |
| 937 this.handlers_.onBeforeInvokeHandler(); | 938 this.handlers_.onBeforeInvokeHandler(); |
| 938 this.handlers_.setMediaRouteStatusObserver(routeId, observer); | 939 this.handlers_.setMediaRouteStatusObserver(routeId, observer); |
| 939 }; | 940 }; |
| 940 | 941 |
| 941 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( | 942 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( |
| 942 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); | 943 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); |
| 943 | 944 |
| 944 return mediaRouter; | 945 return mediaRouter; |
| 945 }); | 946 }); |
| OLD | NEW |