| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 * @type {function()} | 552 * @type {function()} |
| 553 */ | 553 */ |
| 554 this.updateMediaSinks = null; | 554 this.updateMediaSinks = null; |
| 555 | 555 |
| 556 /** | 556 /** |
| 557 * @type {function(string, string, !SinkSearchCriteria): string} | 557 * @type {function(string, string, !SinkSearchCriteria): string} |
| 558 */ | 558 */ |
| 559 this.searchSinks = null; | 559 this.searchSinks = null; |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @type {function()} |
| 563 */ |
| 564 this.provideSinks = null; |
| 565 |
| 566 /** |
| 562 * @type {function(string, !bindings.InterfaceRequest): !Promise<boolean>} | 567 * @type {function(string, !bindings.InterfaceRequest): !Promise<boolean>} |
| 563 */ | 568 */ |
| 564 this.createMediaRouteController = null; | 569 this.createMediaRouteController = null; |
| 565 | 570 |
| 566 /** | 571 /** |
| 567 * @type {function(string, !mediaStatusMojom.MediaStatusObserverPtr)} | 572 * @type {function(string, !mediaStatusMojom.MediaStatusObserverPtr)} |
| 568 */ | 573 */ |
| 569 this.setMediaRouteStatusObserver = null; | 574 this.setMediaRouteStatusObserver = null; |
| 570 }; | 575 }; |
| 571 | 576 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 'detachRoute', | 616 'detachRoute', |
| 612 'terminateRoute', | 617 'terminateRoute', |
| 613 'joinRoute', | 618 'joinRoute', |
| 614 'createRoute', | 619 'createRoute', |
| 615 'stopObservingMediaSinks', | 620 'stopObservingMediaSinks', |
| 616 'startObservingMediaRoutes', | 621 'startObservingMediaRoutes', |
| 617 'connectRouteByRouteId', | 622 'connectRouteByRouteId', |
| 618 'enableMdnsDiscovery', | 623 'enableMdnsDiscovery', |
| 619 'updateMediaSinks', | 624 'updateMediaSinks', |
| 620 'searchSinks', | 625 'searchSinks', |
| 626 'provideSinks', |
| 621 'createMediaRouteController', | 627 'createMediaRouteController', |
| 622 'setMediaRouteStatusObserver', | 628 'setMediaRouteStatusObserver', |
| 623 'onBeforeInvokeHandler' | 629 'onBeforeInvokeHandler' |
| 624 ]; | 630 ]; |
| 625 requiredHandlers.forEach(function(nextHandler) { | 631 requiredHandlers.forEach(function(nextHandler) { |
| 626 if (handlers[nextHandler] === undefined) { | 632 if (handlers[nextHandler] === undefined) { |
| 627 console.error(nextHandler + ' handler not registered.'); | 633 console.error(nextHandler + ' handler not registered.'); |
| 628 } | 634 } |
| 629 }); | 635 }); |
| 630 } | 636 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 } | 898 } |
| 893 return searchSinksResponse.then( | 899 return searchSinksResponse.then( |
| 894 sink_id => { | 900 sink_id => { |
| 895 return { 'sink_id': sink_id }; | 901 return { 'sink_id': sink_id }; |
| 896 }, | 902 }, |
| 897 () => { | 903 () => { |
| 898 return { 'sink_id': '' }; | 904 return { 'sink_id': '' }; |
| 899 }); | 905 }); |
| 900 }; | 906 }; |
| 901 | 907 |
| 908 /** |
| 909 * Notifies the provider manager that MediaRouter has discovered a list of |
| 910 * sinks. |
| 911 * @param {string} providerName |
| 912 * @param {!Array<!mediaRouterMojom.MediaSink>} sinks |
| 913 */ |
| 914 MediaRouteProvider.prototype.provideSinks = function(providerName, sinks) { |
| 915 this.handlers_.onBeforeInvokeHandler(); |
| 916 this.handlers_.provideSinks(providerName, sinks); |
| 917 }; |
| 902 | 918 |
| 903 /** | 919 /** |
| 904 * Creates a controller for the given route and binds the given | 920 * Creates a controller for the given route and binds the given |
| 905 * InterfaceRequest to it. | 921 * InterfaceRequest to it. |
| 906 * @param {string} routeId | 922 * @param {string} routeId |
| 907 * @param {!bindings.InterfaceRequest} controllerRequest | 923 * @param {!bindings.InterfaceRequest} controllerRequest |
| 908 * @return {!Promise<!{success: boolean}>} Resolves to true if a controller | 924 * @return {!Promise<!{success: boolean}>} Resolves to true if a controller |
| 909 * is created. Resolves to false if a controller cannot be created, or if | 925 * is created. Resolves to false if a controller cannot be created, or if |
| 910 * the controller is already bound. | 926 * the controller is already bound. |
| 911 */ | 927 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 936 } | 952 } |
| 937 this.handlers_.onBeforeInvokeHandler(); | 953 this.handlers_.onBeforeInvokeHandler(); |
| 938 this.handlers_.setMediaRouteStatusObserver(routeId, observer); | 954 this.handlers_.setMediaRouteStatusObserver(routeId, observer); |
| 939 }; | 955 }; |
| 940 | 956 |
| 941 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( | 957 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( |
| 942 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); | 958 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); |
| 943 | 959 |
| 944 return mediaRouter; | 960 return mediaRouter; |
| 945 }); | 961 }); |
| OLD | NEW |