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

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

Issue 2142613002: [Media Router WebUI] Move replace route responsibility to extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename event name in route_details_tests.js Created 4 years, 4 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 ecd5810bfda626b3c608c9a2d5f20ea75b5d282f..ca89bb01e235b4d1fffa918aa12d050a0cb89a63 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
@@ -192,17 +192,6 @@ Polymer({
},
/**
- * Whether the sink with a pending route creation, whose ID is given by
- * |currentLaunchingSinkId_|, is waiting for the current route to it to be
- * closed so a new one can be started.
- * @private {boolean}
- */
- launchingSinkAwaitingRouteClose_: {
- type: Boolean,
- value: false,
- },
-
- /**
* Whether the user's mouse is positioned over the dialog.
* @private {boolean|undefined}
*/
@@ -1585,6 +1574,26 @@ Polymer({
},
/**
+ * Handles a change-route-source-click event. Sets the currently launching
+ * sink to be the current route's sink and shows the sink list.
+ *
+ * @param {!Event} event The event object.
+ * Parameters in |event|.detail:
+ * route - route to modify.
+ * selectedCastMode - cast mode to use for the new source.
+ * @private
+ */
+ onChangeRouteSourceClick_: function(event) {
+ /** @type {{route: !media_router.Route, selectedCastMode: number}} */
+ var detail = event.detail;
+ this.currentLaunchingSinkId_ = detail.route.sinkId;
+ var sink = this.sinkMap_[detail.route.sinkId];
+ this.showSinkList_();
+ this.maybeReportUserFirstAction(
+ media_router.MediaRouterUserAction.REPLACE_LOCAL_ROUTE);
+ },
+
+ /**
* Handles a close-route event. Shows the sink list and starts a timer to
* close the dialog if there is no click within three seconds.
*
@@ -1740,28 +1749,6 @@ Polymer({
},
/**
- * Handles a replace-route-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
- */
- onReplaceRouteClick_: function(event) {
- /** @type {{route: !media_router.Route}} */
- var detail = event.detail;
- this.currentLaunchingSinkId_ = detail.route.sinkId;
- this.launchingSinkAwaitingRouteClose_ = true;
- this.fire('close-route', detail);
- this.showSinkList_();
- this.maybeReportUserFirstAction(
- media_router.MediaRouterUserAction.REPLACE_LOCAL_ROUTE);
- },
-
- /**
* Called when a sink is clicked.
*
* @param {!Event} event The event object.
@@ -1972,14 +1959,6 @@ 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.launchingSinkAwaitingRouteClose_ &&
- !(this.currentLaunchingSinkId_ in this.sinkToRouteMap_) &&
- this.currentLaunchingSinkId_ in this.sinkMap_) {
- this.showOrCreateRoute_(this.sinkMap_[this.currentLaunchingSinkId_]);
- }
},
/**
@@ -2199,9 +2178,7 @@ Polymer({
this.fire('navigate-sink-list-to-details');
this.maybeReportUserFirstAction(
media_router.MediaRouterUserAction.STATUS_REMOTE);
- } else if ((this.launchingSinkAwaitingRouteClose_ &&
- this.currentLaunchingSinkId_ == sink.id) ||
- this.currentLaunchingSinkId_ == '') {
+ } else if (this.currentLaunchingSinkId_ == '') {
// Allow one launch at a time.
var selectedCastModeValue =
this.shownCastModeValue_ == media_router.CastModeType.AUTO ?
@@ -2228,11 +2205,7 @@ Polymer({
performance.now() - this.populatedSinkListSeenTimeMs_;
this.fire('report-sink-click-time', {timeMs: timeToSelectSink});
}
- if (!this.launchingSinkAwaitingRouteClose_) {
- this.currentLaunchingSinkId_ = sink.id;
- } else {
- this.launchingSinkAwaitingRouteClose_ = false;
- }
+ this.currentLaunchingSinkId_ = sink.id;
if (sink.isPseudoSink) {
this.rebuildSinksToShow_();
}

Powered by Google App Engine
This is Rietveld 408576698