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

ash / quick_insert / metrics / quick_insert_feature_usage_metrics.cc [blame]

// Copyright 2024 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/quick_insert/metrics/quick_insert_feature_usage_metrics.h"

#include <string_view>

#include "chromeos/ash/components/feature_usage/feature_usage_metrics.h"

namespace ash {

QuickInsertFeatureUsageMetrics::QuickInsertFeatureUsageMetrics()
    : feature_usage_metrics_("Picker", this) {}

QuickInsertFeatureUsageMetrics::~QuickInsertFeatureUsageMetrics() = default;

bool QuickInsertFeatureUsageMetrics::IsEligible() const {
  // All devices support Quick Insert.
  return true;
}

std::optional<bool> QuickInsertFeatureUsageMetrics::IsAccessible() const {
  // TODO(b/321865738): Check enterprise policy.
  return true;
}

bool QuickInsertFeatureUsageMetrics::IsEnabled() const {
  // TODO(b/321865738): Check settings.
  return true;
}

void QuickInsertFeatureUsageMetrics::StartUsage() {
  // There are no "failed" usages. All attempts should succeed.
  feature_usage_metrics_.RecordUsage(/*success=*/true);
  feature_usage_metrics_.StartSuccessfulUsage();
}

void QuickInsertFeatureUsageMetrics::StopUsage() {
  feature_usage_metrics_.StopSuccessfulUsage();
}

}  // namespace ash