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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return { | 276 return { |
273 Binding: bindings.Binding, | 277 Binding: bindings.Binding, |
274 DialMediaSink: mediaRouterMojom.DialMediaSink, | 278 DialMediaSink: mediaRouterMojom.DialMediaSink, |
275 CastMediaSink: mediaRouterMojom.CastMediaSink, | 279 CastMediaSink: mediaRouterMojom.CastMediaSink, |
276 IPAddress: ipAddressMojom.IPAddress, | 280 IPAddress: ipAddressMojom.IPAddress, |
277 InterfacePtrController: bindings.InterfacePtrController, | 281 InterfacePtrController: bindings.InterfacePtrController, |
278 InterfaceRequest: bindings.InterfaceRequest, | 282 InterfaceRequest: bindings.InterfaceRequest, |
279 MediaController: mediaControllerMojom.MediaController, | 283 MediaController: mediaControllerMojom.MediaController, |
280 MediaStatus: mediaStatusMojom.MediaStatus, | 284 MediaStatus: mediaStatusMojom.MediaStatus, |
281 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, | 285 MediaStatusObserverPtr: mediaStatusMojom.MediaStatusObserverPtr, |
| 286 MirrorServiceRemoter: remotingMojom.MirrorServiceRemoter, |
| 287 MirrorServiceRemoterPtr: remotingMojom.MirrorServiceRemoterPtr, |
| 288 MirrorServiceRemotingSourcePtr: |
| 289 remotingMojom.MirrorServiceRemotingSourcePtr, |
| 290 RemotingStopReason: remotingCommonMojom.RemotingStopReason, |
| 291 RemotingStartFailReason: remotingCommonMojom.RemotingStartFailReason, |
| 292 RemotingSinkFeatures: remotingCommonMojom.RemotingSinkFeatures, |
| 293 RemotingSinkAudioCapabilities: |
| 294 remotingCommonMojom.RemotingSinkAudioCapabilities, |
| 295 RemotingSinkVideoCapabilities: |
| 296 remotingCommonMojom.RemotingSinkVideoCapabilities, |
| 297 SinkCapabilities: remotingCommonMojom.SinkCapabilities, |
282 Origin: originMojom.Origin, | 298 Origin: originMojom.Origin, |
283 Sink: mediaRouterMojom.MediaSink, | 299 Sink: mediaRouterMojom.MediaSink, |
284 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, | 300 SinkExtraData: mediaRouterMojom.MediaSinkExtraData, |
285 TimeDelta: timeMojom.TimeDelta, | 301 TimeDelta: timeMojom.TimeDelta, |
286 Url: urlMojom.Url, | 302 Url: urlMojom.Url, |
| 303 makeRequest: bindings.makeRequest, |
287 }; | 304 }; |
288 }; | 305 }; |
289 | 306 |
290 /** | 307 /** |
291 * Registers the Media Router Provider Manager with the Media Router. | 308 * Registers the Media Router Provider Manager with the Media Router. |
292 * @return {!Promise<Object>} Instance ID and config for the Media Router. | 309 * @return {!Promise<Object>} Instance ID and config for the Media Router. |
293 */ | 310 */ |
294 MediaRouter.prototype.start = function() { | 311 MediaRouter.prototype.start = function() { |
295 return this.service_.registerMediaRouteProvider( | 312 return this.service_.registerMediaRouteProvider( |
296 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()); | 313 this.mediaRouteProviderBinding_.createInterfacePtrAndBind()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 /** | 475 /** |
459 * @param {string} routeId | 476 * @param {string} routeId |
460 * @param {!Array<!RouteMessage>} mesages | 477 * @param {!Array<!RouteMessage>} mesages |
461 */ | 478 */ |
462 MediaRouter.prototype.onRouteMessagesReceived = function(routeId, messages) { | 479 MediaRouter.prototype.onRouteMessagesReceived = function(routeId, messages) { |
463 this.service_.onRouteMessagesReceived( | 480 this.service_.onRouteMessagesReceived( |
464 routeId, messages.map(messageToMojo_)); | 481 routeId, messages.map(messageToMojo_)); |
465 }; | 482 }; |
466 | 483 |
467 /** | 484 /** |
| 485 * @param {number} tabId |
| 486 * @param {!remotingMojom.MirrorServiceRemoterPtr} remoter |
| 487 * @param {!remotingMojom.MirrorServiceRemotingSourcePtr} remotingSource |
| 488 */ |
| 489 MediaRouter.prototype.onMediaRemoterCreated = function(tabId, remoter, |
| 490 remotingSource) { |
| 491 this.service_.onMediaRemoterCreated(tabId, remoter, remotingSource); |
| 492 } |
| 493 |
| 494 /** |
468 * Object containing callbacks set by the provider manager. | 495 * Object containing callbacks set by the provider manager. |
469 * | 496 * |
470 * @constructor | 497 * @constructor |
471 * @struct | 498 * @struct |
472 */ | 499 */ |
473 function MediaRouterHandlers() { | 500 function MediaRouterHandlers() { |
474 /** | 501 /** |
475 * @type {function(!string, !string, !string, !string, !number)} | 502 * @type {function(!string, !string, !string, !string, !number)} |
476 */ | 503 */ |
477 this.createRoute = null; | 504 this.createRoute = null; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 return this.handlers_ | 953 return this.handlers_ |
927 .createMediaRouteController(routeId, controllerRequest, observer) | 954 .createMediaRouteController(routeId, controllerRequest, observer) |
928 .then(() => ({success: true}), e => ({success: false})); | 955 .then(() => ({success: true}), e => ({success: false})); |
929 }; | 956 }; |
930 | 957 |
931 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( | 958 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( |
932 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); | 959 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); |
933 | 960 |
934 return mediaRouter; | 961 return mediaRouter; |
935 }); | 962 }); |
OLD | NEW |