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

Unified Diff: chrome/browser/resources/media_router/media_router.js

Issue 2002293003: [Media Router] Allow casting new media to sink with existing route. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/media_router/media_router.js
diff --git a/chrome/browser/resources/media_router/media_router.js b/chrome/browser/resources/media_router/media_router.js
index 834f9effc655bd84f1fc3004b5d1c4caf8872abb..f5883c21be309ae777b650bce5643f96eff22695 100644
--- a/chrome/browser/resources/media_router/media_router.js
+++ b/chrome/browser/resources/media_router/media_router.js
@@ -37,6 +37,8 @@ cr.define('media_router', function() {
container.addEventListener('cast-mode-selected', onCastModeSelected);
container.addEventListener('close-dialog', onCloseDialog);
container.addEventListener('close-route-click', onCloseRouteClick);
+ container.addEventListener('close-route-for-new-media',
+ onCloseRouteForNewMedia);
amp 2016/05/23 21:42:35 Can't this reuse the onCloseRouteClick handler as
btolsch 2016/05/23 22:41:10 It is identical, but I wasn't sure if it would be
apacible 2016/05/25 00:56:34 Reusing onCloseRouteClick is fine.
container.addEventListener('create-route', onCreateRoute);
container.addEventListener('issue-action-click', onIssueActionClick);
container.addEventListener('navigate-sink-list-to-details',
@@ -221,6 +223,20 @@ cr.define('media_router', function() {
}
/**
+ * Stops a route.
+ * Called when the user requests to cast to a sink that already has a route.
+ *
+ * @param {!Event} event
+ * Parameters in |event|.detail:
+ * route - The route to close.
+ */
+ function onCloseRouteForNewMedia(event) {
+ /** @type {{route: !media_router.Route}} */
+ var detail = event.detail;
+ media_router.browserApi.closeRoute(detail.route);
+ }
+
+ /**
* Starts casting to an existing route.
* Called when the user requests to start casting to a media route.
*

Powered by Google App Engine
This is Rietveld 408576698