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

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

Issue 1245213002: [MediaRouter] Implement send binary message from PSDImpl to MRPManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override in media_router_android Created 5 years, 5 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/service_provider', 10 'content/public/renderer/service_provider',
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 * @type {function(string)} 309 * @type {function(string)}
310 */ 310 */
311 this.stopObservingMediaSinks = null; 311 this.stopObservingMediaSinks = null;
312 312
313 /** 313 /**
314 * @type {function(string, string): Promise} 314 * @type {function(string, string): Promise}
315 */ 315 */
316 this.sendRouteMessage = null; 316 this.sendRouteMessage = null;
317 317
318 /** 318 /**
319 * @type {function(string, Array.<uint8>): Promise}
320 */
321 this.sendRouteBinaryMessage = null;
322
323 /**
319 * @type {function(Array.<string>): Promise.<Array.<RouteMessage>>} 324 * @type {function(Array.<string>): Promise.<Array.<RouteMessage>>}
320 */ 325 */
321 this.listenForRouteMessages = null; 326 this.listenForRouteMessages = null;
322 327
323 /** 328 /**
324 * @type {function()} 329 * @type {function()}
325 */ 330 */
326 this.startObservingMediaRoutes = null; 331 this.startObservingMediaRoutes = null;
327 332
328 /** 333 /**
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 * 366 *
362 * TODO(mfoltz): Rename to something more explicit? 367 * TODO(mfoltz): Rename to something more explicit?
363 * @param {!MediaRouterHandlers} handlers 368 * @param {!MediaRouterHandlers} handlers
364 */ 369 */
365 MediaRouteProvider.prototype.setHandlers = function(handlers) { 370 MediaRouteProvider.prototype.setHandlers = function(handlers) {
366 this.handlers_ = handlers; 371 this.handlers_ = handlers;
367 var requiredHandlers = [ 372 var requiredHandlers = [
368 'stopObservingMediaRoutes', 373 'stopObservingMediaRoutes',
369 'startObservingMediaRoutes', 374 'startObservingMediaRoutes',
370 'sendRouteMessage', 375 'sendRouteMessage',
376 'sendRouteBinaryMessage',
371 'listenForRouteMessages', 377 'listenForRouteMessages',
372 'closeRoute', 378 'closeRoute',
373 'joinRoute', 379 'joinRoute',
374 'createRoute', 380 'createRoute',
375 'stopObservingMediaSinks', 381 'stopObservingMediaSinks',
376 'startObservingMediaRoutes' 382 'startObservingMediaRoutes'
377 ]; 383 ];
378 requiredHandlers.forEach(function(nextHandler) { 384 requiredHandlers.forEach(function(nextHandler) {
379 if (handlers[nextHandler] === undefined) { 385 if (handlers[nextHandler] === undefined) {
380 console.error(nextHandler + ' handler not registered.'); 386 console.error(nextHandler + ' handler not registered.');
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 routeId, message) { 478 routeId, message) {
473 return this.handlers_.sendRouteMessage(routeId, message) 479 return this.handlers_.sendRouteMessage(routeId, message)
474 .then(function() { 480 .then(function() {
475 return true; 481 return true;
476 }, function() { 482 }, function() {
477 return false; 483 return false;
478 }); 484 });
479 }; 485 };
480 486
481 /** 487 /**
488 * Sends a binary message to the route designated by |routeId|.
489 * @param {!string} routeId
490 * @param {!Array.<uint8>} data
Kevin M 2015/07/22 18:31:50 "uint8" isn't a valid JS type?
USE s.singapati at gmail.com 2015/07/23 19:52:53 Done. Changed to Uint8Array.
491 * @return {!Promise.<boolean>} Resolved with true if the data was sent,
492 * or false on failure.
493 */
494 MediaRouteProvider.prototype.sendRouteBinaryMessage = function(
495 routeId, data) {
496 return this.handlers_.sendRouteBinaryMessage(routeId, data)
497 .then(function() {
Kevin M 2015/07/22 18:34:04 Please refer to the fix in CL #1249083003 and make
USE s.singapati at gmail.com 2015/07/23 19:52:53 Done.
498 return true;
499 }, function() {
500 return false;
501 });
502 };
503
504 /**
482 * Listen for next batch of messages from one of the routeIds. 505 * Listen for next batch of messages from one of the routeIds.
483 * @param {!Array.<string>} routeIds 506 * @param {!Array.<string>} routeIds
484 * @return {!Promise.<Array.<RouteMessage>>} Resolved with a list of messages, 507 * @return {!Promise.<Array.<RouteMessage>>} Resolved with a list of messages,
485 * an empty list if an error occurred. 508 * an empty list if an error occurred.
486 */ 509 */
487 MediaRouteProvider.prototype.listenForRouteMessages = function(routeIds) { 510 MediaRouteProvider.prototype.listenForRouteMessages = function(routeIds) {
488 return this.handlers_.listenForRouteMessages(routeIds) 511 return this.handlers_.listenForRouteMessages(routeIds)
489 .then(function(messages) { 512 .then(function(messages) {
490 return {'messages': messages.map(messageToMojo_)}; 513 return {'messages': messages.map(messageToMojo_)};
491 }, function() { 514 }, function() {
(...skipping 18 matching lines...) Expand all
510 }; 533 };
511 534
512 mediaRouter = new MediaRouter(connector.bindHandleToProxy( 535 mediaRouter = new MediaRouter(connector.bindHandleToProxy(
513 serviceProvider.connectToService( 536 serviceProvider.connectToService(
514 mediaRouterMojom.MediaRouter.name), 537 mediaRouterMojom.MediaRouter.name),
515 mediaRouterMojom.MediaRouter)); 538 mediaRouterMojom.MediaRouter));
516 539
517 return mediaRouter; 540 return mediaRouter;
518 }); 541 });
519 542
OLDNEW
« chrome/browser/media/router/test_helper.h ('K') | « chrome/browser/media/router/test_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698