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

Unified Diff: extensions/renderer/resources/media_router_bindings.js

Issue 2485313002: [Media Router] Remove obsolete code and bindings. (Closed)
Patch Set: Respond to imcheng@ comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5f0d9a0a824f59254b49332b6eb0c2b39469bccf..faf7d00325573260faaf3258cfe8ee10e37f7068 100644
--- a/extensions/renderer/resources/media_router_bindings.js
+++ b/extensions/renderer/resources/media_router_bindings.js
@@ -265,13 +265,12 @@ define('media_router_bindings', [
* updated.
* @param {!string} sourceUrn
* @param {!Array<!MediaSink>} sinks
- * @param {Array<string>=} opt_origins
+ * @param {!Array<string>} origins
*/
MediaRouter.prototype.onSinksReceived = function(sourceUrn, sinks,
- opt_origins) {
- // TODO(imcheng): Make origins required in M52+.
+ origins) {
this.service_.onSinksReceived(sourceUrn, sinks.map(sinkToMojo_),
- opt_origins || []);
+ origins);
};
/**
@@ -357,23 +356,17 @@ define('media_router_bindings', [
* Called by the provider manager when the set of active routes
* has been updated.
* @param {!Array<MediaRoute>} routes The active set of media routes.
- * @param {string=} opt_sourceUrn The sourceUrn associated with this route
- * query. This parameter is optional and can be empty.
- * @param {Array<string>=} opt_joinableRouteIds The active set of joinable
- * media routes. This parameter is optional and can be empty.
+ * @param {string=} sourceUrn The sourceUrn associated with this route
+ * query.
+ * @param {Array<string>=} joinableRouteIds The active set of joinable
+ * media routes.
*/
MediaRouter.prototype.onRoutesUpdated =
- function(routes, opt_sourceUrn, opt_joinableRouteIds) {
- // TODO(boetger): This check allows backward compatibility with the Cast SDK
- // and can be removed when the Cast SDK is updated.
- if (typeof(opt_sourceUrn) != 'string') {
- opt_sourceUrn = '';
- }
-
+ function(routes, sourceUrn = '', joinableRouteIds = []) {
this.service_.onRoutesUpdated(
routes.map(routeToMojo_),
- opt_sourceUrn || '',
- opt_joinableRouteIds || []);
+ sourceUrn,
+ joinableRouteIds);
};
/**
@@ -462,13 +455,6 @@ define('media_router_bindings', [
this.sendRouteBinaryMessage = null;
/**
- * TODO(imcheng): Remove in M55 (crbug.com/626395).
- * @type {function(string):
- * Promise.<{messages: Array.<RouteMessage>, error: boolean}>}
- */
- this.listenForRouteMessages = null;
-
- /**
* @type {function(string)}
*/
this.startListeningForRouteMessages = null;
@@ -703,20 +689,9 @@ define('media_router_bindings', [
*/
MediaRouteProvider.prototype.terminateRoute = function(routeId) {
this.handlers_.onBeforeInvokeHandler();
- // TODO(crbug.com/627967): Remove code path that doesn't expect a Promise
- // in M56.
- var maybePromise = this.handlers_.terminateRoute(routeId);
- var successResult = {
- result_code: mediaRouterMojom.RouteRequestResultCode.OK
- };
- if (maybePromise) {
- return maybePromise.then(
- function() { return successResult; },
- function(err) { return toErrorRouteResponse_(err); }
- );
- } else {
- return Promise.resolve(successResult);
- }
+ return this.handlers_.terminateRoute(routeId).then(
+ () => ({result_code: mediaRouterMojom.RouteRequestResultCode.OK}),
+ (err) => toErrorRouteResponse_(err));
};
/**
@@ -762,35 +737,7 @@ define('media_router_bindings', [
MediaRouteProvider.prototype.startListeningForRouteMessages = function(
routeId) {
this.handlers_.onBeforeInvokeHandler();
- if (this.handlers_.startListeningForRouteMessages) {
- this.handlers_.startListeningForRouteMessages(routeId);
- } else {
- // Old API.
- this.listenForRouteMessagesOld(routeId);
- }
- };
-
-
- /**
- * A hack to adapt new MR messaging API to old extension messaging API.
- * TODO(imcheng): Remove in M55 (crbug.com/626395).
- * @param {!string} routeId
- */
- MediaRouteProvider.prototype.listenForRouteMessagesOld = function(routeId) {
- this.handlers_.onBeforeInvokeHandler();
- this.handlers_.listenForRouteMessages(routeId)
- .then(function(messages) {
- // If messages is empty, then stopListeningForRouteMessages has been
- // called. We don't need to send it back to MR.
- if (messages.length > 0) {
- // Send the messages back to MR, and listen for next batch of
- // messages.
- this.mediaRouter_.onRouteMessagesReceived(routeId, messages);
- this.listenForRouteMessagesOld(routeId);
- }
- }.bind(this), function() {
- // Ignore rejections.
- }.bind(this));
+ this.handlers_.startListeningForRouteMessages(routeId);
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698