diff options
Diffstat (limited to 'extensions/renderer/resources')
-rw-r--r-- | extensions/renderer/resources/media_router_bindings.js | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/extensions/renderer/resources/media_router_bindings.js b/extensions/renderer/resources/media_router_bindings.js index 6c711fd..6491d88 100644 --- a/extensions/renderer/resources/media_router_bindings.js +++ b/extensions/renderer/resources/media_router_bindings.js @@ -321,11 +321,17 @@ define('media_router_bindings', [ this.sendRouteBinaryMessage = null; /** - * @type {function(string): Promise.<Array.<RouteMessage>>} + * @type {function(string): + * Promise.<{messages: Array.<RouteMessage>, error: boolean}>} */ this.listenForRouteMessages = null; /** + * @type {function(string)} + */ + this.stopListeningForRouteMessages = null; + + /** * @type {function()} */ this.startObservingMediaRoutes = null; @@ -375,6 +381,7 @@ define('media_router_bindings', [ 'sendRouteMessage', 'sendRouteBinaryMessage', 'listenForRouteMessages', + 'stopListeningForRouteMessages', 'closeRoute', 'joinRoute', 'createRoute', @@ -504,19 +511,30 @@ define('media_router_bindings', [ /** * Listen for next batch of messages from one of the routeIds. * @param {!string} routeId - * @return {!Promise.<Array.<RouteMessage>>} Resolved with a list of messages, - * an empty list if an error occurred. + * @return {!Promise.<{messages: Array.<RouteMessage>, error: boolean}>} + * Resolved with a list of messages, and a boolean indicating if an error + * occurred. */ MediaRouteProvider.prototype.listenForRouteMessages = function(routeId) { return this.handlers_.listenForRouteMessages(routeId) .then(function(messages) { - return {'messages': messages.map(messageToMojo_)}; + return {'messages': messages.map(messageToMojo_), 'error': false}; }, function() { - return {'messages': []}; + return {'messages': [], 'error': true}; }); }; /** + * If there is an outstanding |listenForRouteMessages| promise for + * |routeId|, resolve that promise with an empty array. + * @param {!string} routeId + */ + MediaRouteProvider.prototype.stopListeningForRouteMessages = function( + routeId) { + return this.handlers_.stopListeningForRouteMessages(routeId); + }; + + /** * Requests that the provider manager start sending information about active * media routes to the Media Router. */ |