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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.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/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index 26362e10a694143a51d0fba9b523a486a1fd99af..c7065c5fce1341f0701b0630c4949601749baea8 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -360,6 +360,16 @@ Polymer({
},
/**
+ * ID of the sink waiting for the current route to it to be closed so a new
+ * one can be started, or the empty string when no such sink is waiting.
+ * @private {string}
+ */
+ sinkIdAwaitingNewRoute_: {
+ type: String,
+ value: '',
+ },
+
+ /**
* Max height for the sink list.
* @private {number}
*/
@@ -1571,6 +1581,25 @@ Polymer({
},
/**
+ * Handles a cast-new-media-click event. Closes the currently displayed local
+ * route and shows the sink list. When the current route has been successfully
+ * removed from the route map, the container will launch a new route for the
+ * same sink.
+ *
+ * @param {!Event} event The event object.
+ * Parameters in |event|.detail:
+ * route - route to close.
+ * @private
+ */
+ onCastNewMediaClick_: function(event) {
+ /** @type {{route: !media_router.Route}} */
+ var detail = event.detail;
+ this.sinkIdAwaitingNewRoute_ = detail.route.sinkId;
+ this.fire('close-route-for-new-media', detail);
+ this.showSinkList_();
+ },
+
+ /**
* Handles a close-route-click event. Shows the sink list and starts a timer
* to close the dialog if there is no click within three seconds.
*
@@ -1936,6 +1965,15 @@ Polymer({
this.sinkToRouteMap_ = tempSinkToRouteMap;
this.rebuildSinksToShow_();
+
+ // A sink was waiting for its route to be closed and removed from the route
+ // map so a new route to it can be started.
+ if (this.sinkIdAwaitingNewRoute_ != '' &&
+ !(this.sinkIdAwaitingNewRoute_ in this.sinkToRouteMap_) &&
+ this.sinkIdAwaitingNewRoute_ in this.sinkMap_) {
+ this.showOrCreateRoute_(this.sinkMap_[this.sinkIdAwaitingNewRoute_]);
+ this.sinkIdAwaitingNewRoute_ = '';
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698