Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: extensions/renderer/resources/media_router_bindings.js

Issue 2679893002: [Media Router] Add ProvideSinks() Mojo API (Closed)
Patch Set: resolve code review comments from Derek and Mark Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_router.mojom', 9 'chrome/browser/media/router/mojo/media_router.mojom',
10 'extensions/common/mojo/keep_alive.mojom', 10 'extensions/common/mojo/keep_alive.mojom',
11 'mojo/common/time.mojom', 11 'mojo/common/time.mojom',
12 'mojo/public/js/bindings', 12 'mojo/public/js/bindings',
13 'url/mojo/origin.mojom', 13 'url/mojo/origin.mojom',
14 'url/mojo/url.mojom',
14 ], function(frameInterfaces, 15 ], function(frameInterfaces,
15 mediaRouterMojom, 16 mediaRouterMojom,
16 keepAliveMojom, 17 keepAliveMojom,
17 timeMojom, 18 timeMojom,
18 bindings, 19 bindings,
19 originMojom) { 20 originMojom) {
20 'use strict'; 21 'use strict';
21 22
22 /** 23 /**
23 * Converts a media sink to a MediaSink Mojo object. 24 * Converts a media sink to a MediaSink Mojo object.
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 515
515 /** 516 /**
516 * @type {function()} 517 * @type {function()}
517 */ 518 */
518 this.updateMediaSinks = null; 519 this.updateMediaSinks = null;
519 520
520 /** 521 /**
521 * @type {function(!string, !string, !SinkSearchCriteria): !string} 522 * @type {function(!string, !string, !SinkSearchCriteria): !string}
522 */ 523 */
523 this.searchSinks = null; 524 this.searchSinks = null;
525
526 /**
527 * @type {function()}
528 */
529 this.provideSinks = null;
524 }; 530 };
525 531
526 /** 532 /**
527 * Routes calls from Media Router to the provider manager extension. 533 * Routes calls from Media Router to the provider manager extension.
528 * Registered with the MediaRouter stub. 534 * Registered with the MediaRouter stub.
529 * @param {!MediaRouter} MediaRouter proxy to call into the 535 * @param {!MediaRouter} MediaRouter proxy to call into the
530 * Media Router mojo interface. 536 * Media Router mojo interface.
531 * @constructor 537 * @constructor
532 */ 538 */
533 function MediaRouteProvider(mediaRouter) { 539 function MediaRouteProvider(mediaRouter) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 'detachRoute', 571 'detachRoute',
566 'terminateRoute', 572 'terminateRoute',
567 'joinRoute', 573 'joinRoute',
568 'createRoute', 574 'createRoute',
569 'stopObservingMediaSinks', 575 'stopObservingMediaSinks',
570 'startObservingMediaRoutes', 576 'startObservingMediaRoutes',
571 'connectRouteByRouteId', 577 'connectRouteByRouteId',
572 'enableMdnsDiscovery', 578 'enableMdnsDiscovery',
573 'updateMediaSinks', 579 'updateMediaSinks',
574 'searchSinks', 580 'searchSinks',
581 'provideSinks',
575 'onBeforeInvokeHandler' 582 'onBeforeInvokeHandler'
576 ]; 583 ];
577 requiredHandlers.forEach(function(nextHandler) { 584 requiredHandlers.forEach(function(nextHandler) {
578 if (handlers[nextHandler] === undefined) { 585 if (handlers[nextHandler] === undefined) {
579 console.error(nextHandler + ' handler not registered.'); 586 console.error(nextHandler + ' handler not registered.');
580 } 587 }
581 }); 588 });
582 } 589 }
583 590
584 /** 591 /**
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // to be missing this API. 842 // to be missing this API.
836 if (!this.handlers_.searchSinks) { 843 if (!this.handlers_.searchSinks) {
837 return Promise.resolve({'sink_id': ''}); 844 return Promise.resolve({'sink_id': ''});
838 } 845 }
839 this.handlers_.onBeforeInvokeHandler(); 846 this.handlers_.onBeforeInvokeHandler();
840 return Promise.resolve({ 847 return Promise.resolve({
841 'sink_id': this.handlers_.searchSinks(sinkId, sourceUrn, searchCriteria) 848 'sink_id': this.handlers_.searchSinks(sinkId, sourceUrn, searchCriteria)
842 }); 849 });
843 }; 850 };
844 851
852 /**
853 * Notifies the provider manager that MediaRouter has discovered a list of
854 * sinks.
855 * @param {!Array<!mediaRouterMojom.MediaSink>} sinks
856 */
857 MediaRouteProvider.prototype.provideSinks = function(sinks) {
btolsch 2017/03/02 06:04:42 This seems to be inconsistent with cl/146753004 an
zhaobin 2017/03/02 20:24:04 Done.
858 this.handlers_.onBeforeInvokeHandler();
859 this.handlers_.provideSinks(sinks);
860 };
861
845 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr( 862 mediaRouter = new MediaRouter(new mediaRouterMojom.MediaRouterPtr(
846 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name))); 863 frameInterfaces.getInterface(mediaRouterMojom.MediaRouter.name)));
847 864
848 return mediaRouter; 865 return mediaRouter;
849 }); 866 });
OLDNEW
« no previous file with comments | « chrome/browser/media/router/mojo/media_router_struct_traits_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698