1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79

ash / public / cpp / feature_discovery_metric_util.cc [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/public/cpp/feature_discovery_metric_util.h"

#include "ash/public/cpp/app_list/app_list_metrics.h"

namespace ash::feature_discovery {

namespace {

// The histogram that records the mock feature's discovery duration.
const char kMockFeatureHistogram[] = "FeatureDiscoveryTestMockFeature";

// The mock histograms that report metrics data under clamshell/tablet.
const char kMockFeatureClamshellHistogram[] =
    "FeatureDiscoveryTestMockFeature.clamshell";
const char kMockFeatureTabletHistogram[] =
    "FeatureDiscoveryTestMockFeature.tablet";

// The mock features' names.
const char kMockFeatureName[] = "kMockFeature";
const char kModeSeparateMockFeatureName[] = "kMockFeatureSeparate";

}  // namespace

// TrackableFeatureInfo --------------------------------------------------------

constexpr TrackableFeatureInfo::TrackableFeatureInfo(
    TrackableFeature param_feature,
    const char* param_feature_name,
    const char* param_histogram_clamshell,
    const char* param_histogram_tablet)
    : feature(param_feature),
      name(param_feature_name),
      histogram(nullptr),
      histogram_clamshell(param_histogram_clamshell),
      histogram_tablet(param_histogram_tablet),
      split_by_tablet_mode(true) {}

constexpr TrackableFeatureInfo::TrackableFeatureInfo(
    TrackableFeature param_feature,
    const char* param_feature_name,
    const char* param_histogram)
    : feature(param_feature),
      name(param_feature_name),
      histogram(param_histogram),
      histogram_clamshell(nullptr),
      histogram_tablet(nullptr),
      split_by_tablet_mode(false) {}

TrackableFeatureInfo::~TrackableFeatureInfo() = default;

// kTrackableFeatureArray ------------------------------------------------------

const std::array<TrackableFeatureInfo, static_cast<int>(TrackableFeature::kMax)>
    kTrackableFeatureArray{
        TrackableFeatureInfo{TrackableFeature::kMockFeature, kMockFeatureName,
                             kMockFeatureHistogram},
        TrackableFeatureInfo{TrackableFeature::kModeSeparateMockFeature,
                             kModeSeparateMockFeatureName,
                             kMockFeatureClamshellHistogram,
                             kMockFeatureTabletHistogram},
        TrackableFeatureInfo{
            TrackableFeature::kAppListReorderAfterEducationNudge,
            "AppListReorderAfterEducationNudge",
            kAppListSortDiscoveryDurationAfterNudge},
        TrackableFeatureInfo{
            TrackableFeature::kAppListReorderAfterSessionActivation,
            "AppListReorderAfterSessionActivation",
            kAppListSortDiscoveryDurationAfterActivation},
        TrackableFeatureInfo{
            TrackableFeature::kAppListReorderAfterEducationNudgePerTabletMode,
            "AppListReorderAfterEducationNudgeSeparated",
            kAppListSortDiscoveryDurationAfterNudgeClamshell,
            kAppListSortDiscoveryDurationAfterNudgeTablet}};

}  // namespace ash::feature_discovery