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

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

Issue 1177073003: [MediaRouter] Update MR-2-Extension's PostMessage to return boolean. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 mediaRouterObserver; 5 var mediaRouterObserver;
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 */ 442 */
443 MediaRouter.prototype.closeRoute = function(routeId) { 443 MediaRouter.prototype.closeRoute = function(routeId) {
444 this.handlers_.closeRoute(routeId); 444 this.handlers_.closeRoute(routeId);
445 }; 445 };
446 446
447 /** 447 /**
448 * Posts a message to the route designated by |routeId|. 448 * Posts a message to the route designated by |routeId|.
449 * @param {!string} routeId 449 * @param {!string} routeId
450 * @param {!string} message 450 * @param {!string} message
451 * @param {string} extraInfoJson 451 * @param {string} extraInfoJson
452 * @return {!Promise.<boolean>} Resolved with true if the message was sent,
453 * or false on failure.
452 */ 454 */
453 MediaRouter.prototype.postMessage = function( 455 MediaRouter.prototype.postMessage = function(
454 routeId, message, extraInfoJson) { 456 routeId, message, extraInfoJson) {
455 // TODO(mfoltz): Remove extraInfoJson if no longer needed. 457 // TODO(mfoltz): Remove extraInfoJson if no longer needed.
mark a. foltz 2015/06/11 05:04:29 Is it possible to take care of this now?
haibinlu 2015/06/11 17:37:17 Done.
456 this.handlers_.postMessage(routeId, message, JSON.parse(extraInfoJson)); 458 this.handlers_.postMessage(routeId, message, JSON.parse(extraInfoJson))
459 .then(function() {
460 return true;
461 }, function() {
462 return false;
463 });
457 }; 464 };
458 465
459 /** 466 /**
460 * Requests that the provider manager start sending information about active 467 * Requests that the provider manager start sending information about active
461 * media routes to the Media Router. 468 * media routes to the Media Router.
462 */ 469 */
463 MediaRouter.prototype.startObservingMediaRoutes = function() { 470 MediaRouter.prototype.startObservingMediaRoutes = function() {
464 this.handlers_.startObservingMediaRoutes(); 471 this.handlers_.startObservingMediaRoutes();
465 }; 472 };
466 473
467 /** 474 /**
468 * Requests that the provider manager stop sending information about active 475 * Requests that the provider manager stop sending information about active
469 * media routes to the Media Router. 476 * media routes to the Media Router.
470 */ 477 */
471 MediaRouter.prototype.stopObservingMediaRoutes = function() { 478 MediaRouter.prototype.stopObservingMediaRoutes = function() {
472 this.handlers_.stopObservingMediaRoutes(); 479 this.handlers_.stopObservingMediaRoutes();
473 }; 480 };
474 481
475 mediaRouterObserver = new MediaRouterObserver(connector.bindHandleToProxy( 482 mediaRouterObserver = new MediaRouterObserver(connector.bindHandleToProxy(
476 serviceProvider.connectToService( 483 serviceProvider.connectToService(
477 mediaRouterMojom.MediaRouterObserver.name), 484 mediaRouterMojom.MediaRouterObserver.name),
478 mediaRouterMojom.MediaRouterObserver)); 485 mediaRouterMojom.MediaRouterObserver));
479 486
480 return mediaRouterObserver; 487 return mediaRouterObserver;
481 }); 488 });
482 489
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