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..e7d34fbe9e9caceb94ac8d410bff6408ff02bd2e 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 |
@@ -19,6 +19,7 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
+#include "chrome/browser/ui/webui/media_router/media_cast_mode.h" |
#include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/grit/generated_resources.h" |
@@ -419,6 +420,14 @@ void MediaRouterWebUIMessageHandler::OnRequestInitialData( |
cast_modes, media_router_ui_->GetPresentationRequestSourceName())); |
initial_data.Set("castModes", cast_modes_list.release()); |
+ // If the cast mode last chosen for the current hostname is tab mirroring, |
+ // that should be the cast mode initially selected in the dialog. Otherwise |
+ // the initial cast mode should be chosen automatically by the dialog. |
+ bool use_tab_mirroring = |
+ base::ContainsKey(cast_modes, MediaCastMode::TAB_MIRROR) && |
+ media_router_ui_->UserSelectedTabMirroringForCurrentHost(); |
apacible
2016/11/16 18:51:10
nitty nit: indent four spaces.
takumif
2016/11/17 01:54:51
Do you mean that L428 should be indented by four m
apacible
2016/11/30 21:54:24
Yes, but I defer to the formatting tool. I'd gotte
|
+ initial_data.SetBoolean("useTabMirroring", use_tab_mirroring); |
+ |
web_ui()->CallJavascriptFunctionUnsafe(kSetInitialData, initial_data); |
media_router_ui_->UIInitialized(); |
} |
@@ -696,8 +705,11 @@ void MediaRouterWebUIMessageHandler::OnReportSelectedCastMode( |
DVLOG(1) << "Unable to extract args."; |
return; |
} |
+ DCHECK(IsValidCastModeNum(cast_mode_type)); |
UMA_HISTOGRAM_SPARSE_SLOWLY("MediaRouter.Ui.Navigate.SourceSelection", |
cast_mode_type); |
+ media_router_ui_->RecordCastModeSelection( |
+ static_cast<MediaCastMode>(cast_mode_type)); |
} |
void MediaRouterWebUIMessageHandler::OnReportSinkCount( |