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 'chrome/common/media_router/mojo/media_controller.mojom', | 8 'chrome/common/media_router/mojo/media_controller.mojom', |
9 'chrome/common/media_router/mojo/media_router.mojom', | 9 'chrome/common/media_router/mojo/media_router.mojom', |
10 'chrome/common/media_router/mojo/media_status.mojom', | 10 'chrome/common/media_router/mojo/media_status.mojom', |
11 'content/public/renderer/frame_interfaces', | 11 'content/public/renderer/frame_interfaces', |
12 'extensions/common/mojo/keep_alive.mojom', | 12 'extensions/common/mojo/keep_alive.mojom', |
| 13 'media/mojo/interfaces/mirror_service_remoting.mojom', |
| 14 'media/mojo/interfaces/remoting_common.mojom', |
13 'mojo/common/time.mojom', | 15 'mojo/common/time.mojom', |
14 'mojo/public/js/bindings', | 16 'mojo/public/js/bindings', |
15 'net/interfaces/ip_address.mojom', | 17 'net/interfaces/ip_address.mojom', |
16 'url/mojo/origin.mojom', | 18 'url/mojo/origin.mojom', |
17 'url/mojo/url.mojom', | 19 'url/mojo/url.mojom', |
18 ], function(mediaControllerMojom, | 20 ], function(mediaControllerMojom, |
19 mediaRouterMojom, | 21 mediaRouterMojom, |
20 mediaStatusMojom, | 22 mediaStatusMojom, |
21 frameInterfaces, | 23 frameInterfaces, |
22 keepAliveMojom, | 24 keepAliveMojom, |
| 25 remotingMojom, |
| 26 remotingCommonMojom, |
23 timeMojom, | 27 timeMojom, |
24 bindings, | 28 bindings, |
25 ipAddressMojom, | 29 ipAddressMojom, |
26 originMojom, | 30 originMojom, |
27 urlMojom) { | 31 urlMojom) { |
28 'use strict'; | 32 'use strict'; |
29 | 33 |
30 /** | 34 /** |
31 * Converts a media sink to a MediaSink Mojo object. | 35 * Converts a media sink to a MediaSink Mojo object. |
32 * @param {!MediaSink} sink A media sink. | 36 * @param {!MediaSink} sink A media sink. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return { | 274 return { |
271 Binding: bindings.Binding, | 275 Binding: bindings.Binding, |
272 DialMediaSink: mediaRouterMojom.DialMediaSink, | 276 DialMediaSink: mediaRouterMojom.DialMediaSink, |
273 CastMediaSink: mediaRouterMojom.CastMediaSink, | 277 CastMediaSink: mediaRouterMojom.CastMediaSink, |
274 IPAddress: ipAddressMojom.IPAddress, | 278 IPAddress: ipAddressMojom.IPAddress, |
275 InterfacePtrController: bindings.InterfacePtrController, | 279 InterfacePtrController: bindings.InterfacePtrController, |
276 InterfaceRequest: bindings.InterfaceRequest, | 280 InterfaceRequest: bindings.InterfaceRequest, |
277 MediaController: mediaControllerMojom.MediaController, | 281 MediaController: mediaControllerMojom.MediaController, |
278 MediaStatus: mediaStatusMojom.MediaStatus, | 282 MediaStatus: mediaStatusMojom.MediaStatus, |
279 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, | 283 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, |
| 284 MirrorServiceRemoter: remotingMojom.MirrorServiceRemoter, |
| 285 MirrorServiceRemoterPtr: remotingMojom.MirrorServiceRemoterPtr, |
| 286 MirrorServiceRemotingSourcePtr: |
| 287 remotingMojom.MirrorServiceRemotingSourcePtr, |
| 288 RemotingStopReason: remotingCommonMojom.RemotingStopReason, |
| 289 RemotingStartFailReason: remotingCommonMojom.RemotingStartFailReason, |
| 290 RemotingSinkCapabilities: remotingCommonMojom.RemotingSinkCapabilities, |
280 Origin: originMojom.Origin, | 291 Origin: originMojom.Origin, |
281 Sink: mediaRouterMojom.MediaSink, | 292 Sink: mediaRouterMojom.MediaSink, |
282 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, | 293 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, |
283 TimeDelta: timeMojom.TimeDelta, | 294 TimeDelta: timeMojom.TimeDelta, |
284 Url: urlMojom.Url, | 295 Url: urlMojom.Url, |
| 296 makeRequest: bindings.makeRequest, |
285 }; | 297 }; |
286 }; | 298 }; |
287 | 299 |
288 /** | 300 /** |
289 * Registers the Media Router Provider Manager with the Media Router. | 301 * Registers the Media Router Provider Manager with the Media Router. |
290 * @return {!Promise<Object>} Instance ID and config for the Media Router. | 302 * @return {!Promise<Object>} Instance ID and config for the Media Router. |
291 */ | 303 */ |
292 MediaRouter.prototype.start = function() { | 304 MediaRouter.prototype.start = function() { |
293 return this.service_.registerMediaRouteProvider( | 305 return this.service_.registerMediaRouteProvider( |
294 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()); | 306 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 /** | 468 /** |
457 * @param {string} routeId | 469 * @param {string} routeId |
458 * @param {!Array<!RouteMessage>} mesages | 470 * @param {!Array<!RouteMessage>} mesages |
459 */ | 471 */ |
460 MediaRouter.prototype.onRouteMessagesReceived = function(routeId, messages) { | 472 MediaRouter.prototype.onRouteMessagesReceived = function(routeId, messages) { |
461 this.service_.onRouteMessagesReceived( | 473 this.service_.onRouteMessagesReceived( |
462 routeId, messages.map(messageToMojo_)); | 474 routeId, messages.map(messageToMojo_)); |
463 }; | 475 }; |
464 | 476 |
465 /** | 477 /** |
| 478 * @param {number} tab_id |
| 479 * @param {!remotingMojom.MirrorServiceRemoterPtr} remoter |
| 480 * @param {!remotingMojom.MirrorServiceRemotingSourcePtr} remoting_source |
| 481 */ |
| 482 MediaRouter.prototype.onMediaRemoterCreated = function(tab_id, remoter, |
| 483 remoting_source) { |
| 484 this.service_.onMediaRemoterCreated(tab_id, remoter, remoting_source); |
| 485 } |
| 486 |
| 487 /** |
466 * Object containing callbacks set by the provider manager. | 488 * Object containing callbacks set by the provider manager. |
467 * | 489 * |
468 * @constructor | 490 * @constructor |
469 * @struct | 491 * @struct |
470 */ | 492 */ |
471 function MediaRouterHandlers() { | 493 function MediaRouterHandlers() { |
472 /** | 494 /** |
473 * @type {function(!string, !string, !string, !string, !number)} | 495 * @type {function(!string, !string, !string, !string, !number)} |
474 */ | 496 */ |
475 this.createRoute = null; | 497 this.createRoute = null; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 return this.handlers_ | 946 return this.handlers_ |
925 .createMediaRouteController(routeId, controllerRequest, observer) | 947 .createMediaRouteController(routeId, controllerRequest, observer) |
926 .then(() => ({success: true}), e => ({success: false})); | 948 .then(() => ({success: true}), e => ({success: false})); |
927 }; | 949 }; |
928 | 950 |
929 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( | 951 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( |
930 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); | 952 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); |
931 | 953 |
932 return mediaRouter; | 954 return mediaRouter; |
933 }); | 955 }); |
OLD | NEW |