Chromium Code Reviews| 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 34eeac20cc0344724b625bf49d0fa25a22030319..54b87d095b70c4da9aaaf2450dfff0afe3612821 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 |
| @@ -28,6 +28,8 @@ const char kCreateRoute[] = "requestRoute"; |
| const char kActOnIssue[] = "actOnIssue"; |
| const char kCloseRoute[] = "closeRoute"; |
| const char kCloseDialog[] = "closeDialog"; |
| +const char kReportClickedSinkIndex[] = "reportClickedSinkIndex"; |
| +const char kReportSelectedCastMode[] = "reportSelectedCastMode"; |
| const char kReportSinkCount[] = "reportSinkCount"; |
| const char kOnInitialDataReceived[] = "onInitialDataReceived"; |
| @@ -249,6 +251,14 @@ void MediaRouterWebUIMessageHandler::RegisterMessages() { |
| base::Bind(&MediaRouterWebUIMessageHandler::OnCloseDialog, |
| base::Unretained(this))); |
| web_ui()->RegisterMessageCallback( |
| + kReportClickedSinkIndex, |
| + base::Bind(&MediaRouterWebUIMessageHandler::OnReportClickedSinkIndex, |
| + base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback( |
| + kReportSelectedCastMode, |
| + base::Bind(&MediaRouterWebUIMessageHandler::OnReportSelectedCastMode, |
| + base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback( |
| kReportSinkCount, |
| base::Bind(&MediaRouterWebUIMessageHandler::OnReportSinkCount, |
| base::Unretained(this))); |
| @@ -364,12 +374,17 @@ void MediaRouterWebUIMessageHandler::OnCloseRoute( |
| DVLOG(1) << "OnCloseRoute"; |
| const base::DictionaryValue* args_dict = nullptr; |
| std::string route_id; |
| + bool is_local; |
| if (!args->GetDictionary(0, &args_dict) || |
| - !args_dict->GetString("routeId", &route_id)) { |
| + !args_dict->GetString("routeId", &route_id) || |
| + !args_dict->GetBoolean("isLocal", &is_local)) { |
| DVLOG(1) << "Unable to extract args."; |
| return; |
| } |
| media_router_ui_->CloseRoute(route_id); |
| + |
| + int route_type = is_local ? 0 : 1; |
| + UMA_HISTOGRAM_COUNTS_100("MediaRouter.Ui.Action.StopRoute", route_type); |
|
Ilya Sherman
2015/12/28 23:13:00
Please use UMA_HISTOGRAM_BOOLEAN if you're only em
apacible
2015/12/29 01:21:01
Done.
|
| } |
| void MediaRouterWebUIMessageHandler::OnCloseDialog( |
| @@ -382,6 +397,30 @@ void MediaRouterWebUIMessageHandler::OnCloseDialog( |
| media_router_ui_->Close(); |
| } |
| +void MediaRouterWebUIMessageHandler::OnReportClickedSinkIndex( |
| + const base::ListValue* args) { |
| + DVLOG(1) << "OnReportClickedSinkIndex"; |
| + int index; |
| + if (!args->GetInteger(0, &index)) { |
| + DVLOG(1) << "Unable to extract args."; |
| + return; |
| + } |
| + UMA_HISTOGRAM_COUNTS_100("MediaRouter.Ui.Action.StartLocalPosition", |
| + index); |
|
Ilya Sherman
2015/12/28 23:13:00
Optional: It might be reasonable to use UMA_HISTOG
apacible
2015/12/29 01:21:01
Done.
|
| +} |
| + |
| +void MediaRouterWebUIMessageHandler::OnReportSelectedCastMode( |
| + const base::ListValue* args) { |
| + DVLOG(1) << "OnReportSelectedCastMode"; |
| + int cast_mode_type; |
| + if (!args->GetInteger(0, &cast_mode_type)) { |
| + DVLOG(1) << "Unable to extract args."; |
| + return; |
| + } |
| + UMA_HISTOGRAM_COUNTS_100("MediaRouter.Ui.Navigate.SourceSelection", |
| + cast_mode_type); |
|
Ilya Sherman
2015/12/28 23:13:00
This should be either UMA_HISTOGRAM_ENUMERATION (p
apacible
2015/12/29 01:21:01
Done.
|
| +} |
| + |
| void MediaRouterWebUIMessageHandler::OnReportSinkCount( |
| const base::ListValue* args) { |
| DVLOG(1) << "OnReportSinkCount"; |