feature_discovery_metric_util.cc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/public/cpp/feature_discovery_metric_util.h"
  5. #include "ash/public/cpp/app_list/app_list_metrics.h"
  6. namespace ash::feature_discovery {
  7. namespace {
  8. // The histogram that records the mock feature's discovery duration.
  9. const char kMockFeatureHistogram[] = "FeatureDiscoveryTestMockFeature";
  10. // The mock histograms that report metrics data under clamshell/tablet.
  11. const char kMockFeatureClamshellHistogram[] =
  12. "FeatureDiscoveryTestMockFeature.clamshell";
  13. const char kMockFeatureTabletHistogram[] =
  14. "FeatureDiscoveryTestMockFeature.tablet";
  15. // The mock features' names.
  16. const char kMockFeatureName[] = "kMockFeature";
  17. const char kModeSeparateMockFeatureName[] = "kMockFeatureSeparate";
  18. } // namespace
  19. // TrackableFeatureInfo --------------------------------------------------------
  20. constexpr TrackableFeatureInfo::TrackableFeatureInfo(
  21. TrackableFeature param_feature,
  22. const char* param_feature_name,
  23. const char* param_histogram_clamshell,
  24. const char* param_histogram_tablet)
  25. : feature(param_feature),
  26. name(param_feature_name),
  27. histogram(nullptr),
  28. histogram_clamshell(param_histogram_clamshell),
  29. histogram_tablet(param_histogram_tablet),
  30. split_by_tablet_mode(true) {}
  31. constexpr TrackableFeatureInfo::TrackableFeatureInfo(
  32. TrackableFeature param_feature,
  33. const char* param_feature_name,
  34. const char* param_histogram)
  35. : feature(param_feature),
  36. name(param_feature_name),
  37. histogram(param_histogram),
  38. histogram_clamshell(nullptr),
  39. histogram_tablet(nullptr),
  40. split_by_tablet_mode(false) {}
  41. TrackableFeatureInfo::~TrackableFeatureInfo() = default;
  42. // kTrackableFeatureArray ------------------------------------------------------
  43. const std::array<TrackableFeatureInfo, static_cast<int>(TrackableFeature::kMax)>
  44. kTrackableFeatureArray{
  45. TrackableFeatureInfo{TrackableFeature::kMockFeature, kMockFeatureName,
  46. kMockFeatureHistogram},
  47. TrackableFeatureInfo{TrackableFeature::kModeSeparateMockFeature,
  48. kModeSeparateMockFeatureName,
  49. kMockFeatureClamshellHistogram,
  50. kMockFeatureTabletHistogram},
  51. TrackableFeatureInfo{
  52. TrackableFeature::kAppListReorderAfterEducationNudge,
  53. "AppListReorderAfterEducationNudge",
  54. kAppListSortDiscoveryDurationAfterNudge},
  55. TrackableFeatureInfo{
  56. TrackableFeature::kAppListReorderAfterSessionActivation,
  57. "AppListReorderAfterSessionActivation",
  58. kAppListSortDiscoveryDurationAfterActivation},
  59. TrackableFeatureInfo{
  60. TrackableFeature::kAppListReorderAfterEducationNudgePerTabletMode,
  61. "AppListReorderAfterEducationNudgeSeparated",
  62. kAppListSortDiscoveryDurationAfterNudgeClamshell,
  63. kAppListSortDiscoveryDurationAfterNudgeTablet}};
  64. } // namespace ash::feature_discovery