#include "components/media_router/browser/media_router_metrics.h"
#include <algorithm>
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/time/default_clock.h"
#include "components/media_router/common/media_route_provider_helper.h"
#include "components/media_router/common/media_sink.h"
#include "components/media_router/common/media_source.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "url/gurl.h"
#include "url/url_constants.h"
namespace media_router {
namespace {
constexpr char kHistogramProviderCreateRouteResult[] = …;
constexpr char kHistogramProviderJoinRouteResult[] = …;
constexpr char kHistogramProviderTerminateRouteResult[] = …;
std::string GetHistogramNameForProvider(
const std::string& base_name,
std::optional<mojom::MediaRouteProviderId> provider_id) { … }
PresentationUrlType GetPresentationUrlType(const GURL& url) { … }
}
MediaRouterMetrics::MediaRouterMetrics() = default;
MediaRouterMetrics::~MediaRouterMetrics() = default;
const char MediaRouterMetrics::kHistogramIconClickLocation[] = …;
const char MediaRouterMetrics::kHistogramMediaRouterFileFormat[] = …;
const char MediaRouterMetrics::kHistogramMediaRouterFileSize[] = …;
const char MediaRouterMetrics::kHistogramMediaSinkType[] = …;
const char MediaRouterMetrics::kHistogramPresentationUrlType[] = …;
const char MediaRouterMetrics::kHistogramUiDeviceCount[] = …;
const char MediaRouterMetrics::kHistogramUiDialogIconStateAtOpen[] = …;
const char MediaRouterMetrics::kHistogramUiCastDialogLoadedWithData[] = …;
const char MediaRouterMetrics::kHistogramUiGmcDialogLoadedWithData[] = …;
const char MediaRouterMetrics::kHistogramUiAndroidDialogType[] = …;
const char MediaRouterMetrics::kHistogramUiAndroidDialogAction[] = …;
const char MediaRouterMetrics::kHistogramUiPermissionRejectedViewAction[] = …;
const char MediaRouterMetrics::kHistogramUserPromptWhenLaunchingCast[] = …;
const char MediaRouterMetrics::kHistogramPendingUserAuthLatency[] = …;
const base::TimeDelta MediaRouterMetrics::kDeviceCountMetricDelay = …;
void MediaRouterMetrics::RecordMediaRouterDialogActivationLocation(
MediaRouterDialogActivationLocation activation_location) { … }
void MediaRouterMetrics::RecordCastDialogLoaded(const base::TimeDelta& delta) { … }
void MediaRouterMetrics::RecordGmcDialogLoaded(const base::TimeDelta& delta) { … }
void MediaRouterMetrics::RecordMediaRouterFileFormat(
const media::container_names::MediaContainerName format) { … }
void MediaRouterMetrics::RecordMediaRouterFileSize(int64_t size) { … }
void MediaRouterMetrics::RecordPresentationUrlType(const GURL& url) { … }
void MediaRouterMetrics::RecordMediaSinkType(SinkIconType sink_icon_type) { … }
void MediaRouterMetrics::RecordMediaSinkTypeForGlobalMediaControls(
SinkIconType sink_icon_type) { … }
void MediaRouterMetrics::RecordMediaSinkTypeForCastDialog(
SinkIconType sink_icon_type) { … }
void MediaRouterMetrics::RecordDeviceCount(int device_count) { … }
void MediaRouterMetrics::RecordIconStateAtDialogOpen(bool is_pinned) { … }
void MediaRouterMetrics::RecordCreateRouteResultCode(
mojom::RouteRequestResultCode result_code,
std::optional<mojom::MediaRouteProviderId> provider_id) { … }
void MediaRouterMetrics::RecordJoinRouteResultCode(
mojom::RouteRequestResultCode result_code,
std::optional<mojom::MediaRouteProviderId> provider_id) { … }
void MediaRouterMetrics::RecordMediaRouteProviderTerminateRoute(
mojom::RouteRequestResultCode result_code,
std::optional<mojom::MediaRouteProviderId> provider_id) { … }
void MediaRouterMetrics::RecordMediaRouterAndroidDialogType(
MediaRouterAndroidDialogType type) { … }
void MediaRouterMetrics::RecordMediaRouterAndroidDialogAction(
MediaRouterAndroidDialogAction action) { … }
void MediaRouterMetrics::RecordMediaRouterUserPromptWhenLaunchingCast(
MediaRouterUserPromptWhenLaunchingCast user_prompt) { … }
void MediaRouterMetrics::RecordMediaRouterPendingUserAuthLatency(
const base::TimeDelta& delta) { … }
void MediaRouterMetrics::RecordMediaRouterUiPermissionRejectedViewEvents(
MediaRouterUiPermissionRejectedViewEvents event) { … }
}