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

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

Issue 2487673003: [Media Router] Make per-hostname cast mode selections persist (Closed)
Patch Set: Use url::Origin for serializing origins, rebase Created 4 years, 1 month 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 9e149ca7aadec32a7cad87d47b20e35c48e610cd..6580294638ba2f3ab524a089e1d75703735d21cc 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
@@ -1561,16 +1561,8 @@ Polymer({
if (!clickedMode)
return;
- this.userHasSelectedCastMode_ = true;
+ this.selectCastMode(clickedMode.type);
this.fire('cast-mode-selected', {castModeType: clickedMode.type});
-
- // The list of sinks to show will be the same if the shown cast mode did
- // not change, regardless of whether the user selected it explicitly.
- if (clickedMode.type != this.shownCastModeValue_) {
- this.setShownCastMode_(clickedMode);
- this.rebuildSinksToShow_();
- }
-
this.showSinkList_();
this.maybeReportUserFirstAction(
media_router.MediaRouterUserAction.CHANGE_MODE);
@@ -2122,6 +2114,20 @@ Polymer({
},
/**
+ * Sets the selected cast mode to the one associated with |castModeType|,
+ * and rebuilds sinks to reflect the change.
+ * @param {number} castModeType The type of the selected cast mode.
+ */
+ selectCastMode: function(castModeType) {
+ var castMode = this.findCastModeByType_(castModeType);
+ if (castMode && castModeType != this.shownCastModeValue_) {
+ this.setShownCastMode_(castMode);
+ this.userHasSelectedCastMode_ = true;
+ this.rebuildSinksToShow_();
+ }
+ },
+
+ /**
* Sets various focus and blur event handlers to handle showing search results
* when the search input is focused.
* @private
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/resources/media_router/media_router_ui_interface.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698