| Index: extensions/renderer/resources/media_router_bindings.js
|
| diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js
|
| index 4eaee9f028618b7edd64ad609824cf6d95e906f7..5e379bb09359cbfc4030133c59e20d1b8b3c9b3e 100644
|
| --- a/extensions/renderer/resources/media_router_bindings.js
|
| +++ b/extensions/renderer/resources/media_router_bindings.js
|
| @@ -275,6 +275,20 @@ define('media_router_bindings', [
|
| };
|
|
|
| /**
|
| + * Called by the provider manager when a sink is found to notify the MR of the
|
| + * sink's ID. The actual sink will be returned through the normal sink list
|
| + * update process, so this helps the MR identify the search result in the
|
| + * list.
|
| + * @param {string} pseudoSinkId ID of the pseudo sink that started the
|
| + * search.
|
| + * @param {string} sinkId ID of the newly-found sink.
|
| + */
|
| + MediaRouter.prototype.onSearchSinkIdReceived = function(
|
| + pseudoSinkId, sinkId) {
|
| + this.service_.onSearchSinkIdReceived(pseudoSinkId, sinkId);
|
| + };
|
| +
|
| + /**
|
| * Called by the provider manager to keep the extension from suspending
|
| * if it enters a state where suspension is undesirable (e.g. there is an
|
| * active MediaRoute.)
|
| @@ -483,6 +497,12 @@ define('media_router_bindings', [
|
| * @type {function()}
|
| */
|
| this.updateMediaSinks = null;
|
| +
|
| + /**
|
| + * @type {function(!string, !string, !SinkSearchCriteria, !string, !string,
|
| + * !number, !number, !boolean)}
|
| + */
|
| + this.searchSinksAndCreateRoute = null;
|
| };
|
|
|
| /**
|
| @@ -533,6 +553,7 @@ define('media_router_bindings', [
|
| 'connectRouteByRouteId',
|
| 'enableMdnsDiscovery',
|
| 'updateMediaSinks',
|
| + 'searchSinksAndCreateRoute',
|
| ];
|
| requiredHandlers.forEach(function(nextHandler) {
|
| if (handlers[nextHandler] === undefined) {
|
| @@ -767,6 +788,42 @@ define('media_router_bindings', [
|
| this.handlers_.updateMediaSinks(sourceUrn);
|
| };
|
|
|
| + /**
|
| + * Requests that the provider manager search its providers for a sink matching
|
| + * |searchCriteria| that is compatible with |sourceUrn|. If a sink is found, a
|
| + * route is created with the remaining parameters the same as createRoute().
|
| + * The route will be returned by this function as for createRoute() but the
|
| + * sink will be returned through the normal sink update process and its ID
|
| + * will be returned through onSearchSinkIdReceived().
|
| + * @param {string} sinkId Sink ID of the pseudo sink generating the request.
|
| + * @param {string} sourceUrn Media source to be used with the sink.
|
| + * @param {!SinkSearchCriteria} searchCriteria Search criteria for the route
|
| + * providers.
|
| + * @param {!string} presentationId Presentation ID from the site
|
| + * requesting presentation. TODO(mfoltz): Remove.
|
| + * @param {!string} origin Origin of site requesting presentation.
|
| + * @param {!number} tabId ID of tab requesting presentation.
|
| + * @param {!number} timeoutMillis If positive, the timeout duration for the
|
| + * request, measured in seconds. Otherwise, the default duration will be
|
| + * used.
|
| + * @param {!boolean} offTheRecord If true, the route is being requested by
|
| + * an off the record (incognito) profile.
|
| + * @return {!Promise.<!Object>} A Promise resolving to an object describing
|
| + * the newly created media route, or rejecting with an error message on
|
| + * failure.
|
| + */
|
| + MediaRouteProvider.prototype.searchSinksAndCreateRoute = function(
|
| + sinkId, sourceUrn, searchCriteria, presentationId, origin, tabId,
|
| + timeoutMillis, offTheRecord) {
|
| + return this.handlers_
|
| + .searchSinksAndCreateRoute(
|
| + sinkId, sourceUrn, searchCriteria, presentationId, origin, tabId,
|
| + timeoutMillis, offTheRecord)
|
| + .then(
|
| + function(route) { return toSuccessRouteResponse_(route); },
|
| + function(err) { return toErrorRouteResponse_(err); });
|
| + };
|
| +
|
| mediaRouter = new MediaRouter(connector.bindHandleToProxy(
|
| serviceProvider.connectToService(
|
| mediaRouterMojom.MediaRouter.name),
|
|
|