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

Unified Diff: chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc

Issue 2487673003: [Media Router] Make per-hostname cast mode selections persist (Closed)
Patch Set: 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/ui/webui/media_router/media_router_webui_message_handler.cc
diff --git a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
index 6fe551cc3eb3bdf03ab5155bee361996b704caef..e9bfe75834b71f016b7610294556181ca351dbe4 100644
--- a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
+++ b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
@@ -419,6 +419,14 @@ void MediaRouterWebUIMessageHandler::OnRequestInitialData(
cast_modes, media_router_ui_->GetPresentationRequestSourceName()));
initial_data.Set("castModes", cast_modes_list.release());
+ MediaCastMode initial_cast_mode =
imcheng 2016/11/14 19:56:59 What if |initial_cast_mode| is not in |cast_modes|
takumif 2016/11/16 01:34:27 Checking to make sure TAB_MIRROR is in |cast_modes
+ media_router_ui_->GetCastModeSelectionForCurrentHost();
+ if (initial_cast_mode != MediaCastMode::DEFAULT) {
takumif 2016/11/08 22:52:16 Right now, GetCastModeSelectionForCurrentHost() re
apacible 2016/11/11 22:40:23 This looks fine.
takumif 2016/11/12 00:08:31 Okay!
imcheng 2016/11/14 19:56:59 Saw this comment after I posted my own comments. N
takumif 2016/11/16 01:34:27 Changing the pref to only keep track of hostnames
+ initial_data.Set(
+ "initialCastMode",
+ new base::FundamentalValue(static_cast<int>(initial_cast_mode)));
+ }
+
web_ui()->CallJavascriptFunctionUnsafe(kSetInitialData, initial_data);
media_router_ui_->UIInitialized();
}
@@ -698,6 +706,8 @@ void MediaRouterWebUIMessageHandler::OnReportSelectedCastMode(
}
UMA_HISTOGRAM_SPARSE_SLOWLY("MediaRouter.Ui.Navigate.SourceSelection",
cast_mode_type);
+ media_router_ui_->RecordCastModeSelection(
+ static_cast<MediaCastMode>(cast_mode_type));
}
void MediaRouterWebUIMessageHandler::OnReportSinkCount(

Powered by Google App Engine
This is Rietveld 408576698