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

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

Issue 1805813002: [Media Router] Wiring for searching route providers for new sinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarifying pseudo sink comments Created 4 years, 8 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 'mojo/public/js/bindings', 8 'mojo/public/js/bindings',
9 'mojo/public/js/core', 9 'mojo/public/js/core',
10 'content/public/renderer/frame_service_registry', 10 'content/public/renderer/frame_service_registry',
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 * @param {Array<string>=} opt_origins 268 * @param {Array<string>=} opt_origins
269 */ 269 */
270 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks, 270 MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks,
271 opt_origins) { 271 opt_origins) {
272 // TODO(imcheng): Make origins required in M52+. 272 // TODO(imcheng): Make origins required in M52+.
273 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_), 273 this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_),
274 opt_origins || []); 274 opt_origins || []);
275 }; 275 };
276 276
277 /** 277 /**
278 * Called by the provider manager when a sink is found to notify the MR of the
279 * sink's ID. The actual sink will be returned through the normal sink list
280 * update process, so this helps the MR identify the search result in the
281 * list.
282 * @param {string} pseudoSinkId ID of the pseudo sink that started the
283 * search.
284 * @param {string} sinkId ID of the newly-found sink.
285 */
286 MediaRouter.prototype.onSearchSinkIdReceived = function(
287 pseudoSinkId, sinkId) {
288 this.service_.onSearchSinkIdReceived(pseudoSinkId, sinkId);
289 };
290
291 /**
278 * Called by the provider manager to keep the extension from suspending 292 * Called by the provider manager to keep the extension from suspending
279 * if it enters a state where suspension is undesirable (e.g. there is an 293 * if it enters a state where suspension is undesirable (e.g. there is an
280 * active MediaRoute.) 294 * active MediaRoute.)
281 * If keepAlive is true, the extension is kept alive. 295 * If keepAlive is true, the extension is kept alive.
282 * If keepAlive is false, the extension is allowed to suspend. 296 * If keepAlive is false, the extension is allowed to suspend.
283 * @param {boolean} keepAlive 297 * @param {boolean} keepAlive
284 */ 298 */
285 MediaRouter.prototype.setKeepAlive = function(keepAlive) { 299 MediaRouter.prototype.setKeepAlive = function(keepAlive) {
286 if (keepAlive === false && this.keepAlive_) { 300 if (keepAlive === false && this.keepAlive_) {
287 this.keepAlive_.close(); 301 this.keepAlive_.close();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 490
477 /** 491 /**
478 * @type {function()} 492 * @type {function()}
479 */ 493 */
480 this.enableMdnsDiscovery = null; 494 this.enableMdnsDiscovery = null;
481 495
482 /** 496 /**
483 * @type {function()} 497 * @type {function()}
484 */ 498 */
485 this.updateMediaSinks = null; 499 this.updateMediaSinks = null;
500
501 /**
502 * @type {function(!string, !string, !SinkSearchCriteria, !string, !string,
503 * !number, !number, !boolean)}
504 */
505 this.searchSinksAndCreateRoute = null;
486 }; 506 };
487 507
488 /** 508 /**
489 * Routes calls from Media Router to the provider manager extension. 509 * Routes calls from Media Router to the provider manager extension.
490 * Registered with the MediaRouter stub. 510 * Registered with the MediaRouter stub.
491 * @param {!MediaRouter} MediaRouter proxy to call into the 511 * @param {!MediaRouter} MediaRouter proxy to call into the
492 * Media Router mojo interface. 512 * Media Router mojo interface.
493 * @constructor 513 * @constructor
494 */ 514 */
495 function MediaRouteProvider(mediaRouter) { 515 function MediaRouteProvider(mediaRouter) {
(...skipping 30 matching lines...) Expand all
526 'stopListeningForRouteMessages', 546 'stopListeningForRouteMessages',
527 'detachRoute', 547 'detachRoute',
528 'terminateRoute', 548 'terminateRoute',
529 'joinRoute', 549 'joinRoute',
530 'createRoute', 550 'createRoute',
531 'stopObservingMediaSinks', 551 'stopObservingMediaSinks',
532 'startObservingMediaRoutes', 552 'startObservingMediaRoutes',
533 'connectRouteByRouteId', 553 'connectRouteByRouteId',
534 'enableMdnsDiscovery', 554 'enableMdnsDiscovery',
535 'updateMediaSinks', 555 'updateMediaSinks',
556 'searchSinksAndCreateRoute',
536 ]; 557 ];
537 requiredHandlers.forEach(function(nextHandler) { 558 requiredHandlers.forEach(function(nextHandler) {
538 if (handlers[nextHandler] === undefined) { 559 if (handlers[nextHandler] === undefined) {
539 console.error(nextHandler + ' handler not registered.'); 560 console.error(nextHandler + ' handler not registered.');
540 } 561 }
541 }); 562 });
542 } 563 }
543 564
544 /** 565 /**
545 * Starts querying for sinks capable of displaying the media source 566 * Starts querying for sinks capable of displaying the media source
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 }; 781 };
761 782
762 /** 783 /**
763 * Requests that the provider manager update media sinks. 784 * Requests that the provider manager update media sinks.
764 * @param {!string} sourceUrn 785 * @param {!string} sourceUrn
765 */ 786 */
766 MediaRouteProvider.prototype.updateMediaSinks = function(sourceUrn) { 787 MediaRouteProvider.prototype.updateMediaSinks = function(sourceUrn) {
767 this.handlers_.updateMediaSinks(sourceUrn); 788 this.handlers_.updateMediaSinks(sourceUrn);
768 }; 789 };
769 790
791 /**
792 * Requests that the provider manager search its providers for a sink matching
793 * |searchCriteria| that is compatible with |sourceUrn|. If a sink is found, a
794 * route is created with the remaining parameters the same as createRoute().
795 * The route will be returned by this function as for createRoute() but the
796 * sink will be returned through the normal sink update process and its ID
797 * will be returned through onSearchSinkIdReceived().
798 * @param {string} sinkId Sink ID of the pseudo sink generating the request.
799 * @param {string} sourceUrn Media source to be used with the sink.
800 * @param {!SinkSearchCriteria} searchCriteria Search criteria for the route
801 * providers.
802 * @param {!string} presentationId Presentation ID from the site
803 * requesting presentation. TODO(mfoltz): Remove.
804 * @param {!string} origin Origin of site requesting presentation.
805 * @param {!number} tabId ID of tab requesting presentation.
806 * @param {!number} timeoutMillis If positive, the timeout duration for the
807 * request, measured in seconds. Otherwise, the default duration will be
808 * used.
809 * @param {!boolean} offTheRecord If true, the route is being requested by
810 * an off the record (incognito) profile.
811 * @return {!Promise.<!Object>} A Promise resolving to an object describing
812 * the newly created media route, or rejecting with an error message on
813 * failure.
814 */
815 MediaRouteProvider.prototype.searchSinksAndCreateRoute = function(
816 sinkId, sourceUrn, searchCriteria, presentationId, origin, tabId,
817 timeoutMillis, offTheRecord) {
818 return this.handlers_
819 .searchSinksAndCreateRoute(
820 sinkId, sourceUrn, searchCriteria, presentationId, origin, tabId,
821 timeoutMillis, offTheRecord)
822 .then(
823 function(route) { return toSuccessRouteResponse_(route); },
824 function(err) { return toErrorRouteResponse_(err); });
825 };
826
770 mediaRouter = new MediaRouter(connector.bindHandleToProxy( 827 mediaRouter = new MediaRouter(connector.bindHandleToProxy(
771 serviceProvider.connectToService( 828 serviceProvider.connectToService(
772 mediaRouterMojom.MediaRouter.name), 829 mediaRouterMojom.MediaRouter.name),
773 mediaRouterMojom.MediaRouter)); 830 mediaRouterMojom.MediaRouter));
774 831
775 return mediaRouter; 832 return mediaRouter;
776 }); 833 });
777 834
OLDNEW
« no previous file with comments | « chrome/test/data/webui/media_router/media_router_elements_browsertest.js ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698