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

ash / ambient / metrics / managed_screensaver_metrics.h [blame]

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

#ifndef ASH_AMBIENT_METRICS_MANAGED_SCREENSAVER_METRICS_H_
#define ASH_AMBIENT_METRICS_MANAGED_SCREENSAVER_METRICS_H_

#include <string>
#include <string_view>

#include "ash/ambient/metrics/ambient_session_metrics_recorder.h"
#include "ash/ash_export.h"

#include "base/timer/elapsed_timer.h"

namespace ash {

enum class ScreensaverImageDownloadResult;

constexpr char kManagedScreensaverEnabledUMA[] = "Enabled";
constexpr char kManagedScreensaverEngagementTimeSlideshowUMA[] =
    "EngagementTime.Slideshow";
constexpr char kManagedScreensaverStartupTimeSlideshowUMA[] =
    "StartupTime.Slideshow";
constexpr char kManagedScreensaverImageCountUMA[] = "ImageCount";
constexpr char kManagedScreensaverImageDownloadResultUMA[] =
    "ImageDownloadResult";

ASH_EXPORT std::string GetManagedScreensaverHistogram(
    std::string_view histogram_suffix);

ASH_EXPORT void RecordManagedScreensaverEnabled(bool enabled);

ASH_EXPORT void RecordManagedScreensaverImageCount(int image_count);

ASH_EXPORT void RecordManagedScreensaverImageDownloadResult(
    ScreensaverImageDownloadResult result);

class ManagedScreensaverMetricsDelegate
    : public AmbientSessionMetricsRecorder::Delegate {
 public:
  ManagedScreensaverMetricsDelegate();
  ~ManagedScreensaverMetricsDelegate() override;
  ManagedScreensaverMetricsDelegate(const ManagedScreensaverMetricsDelegate&) =
      delete;
  ManagedScreensaverMetricsDelegate& operator=(
      const ManagedScreensaverMetricsDelegate&) = delete;

  void RecordStartupTime(base::TimeDelta startup_time) override;
  void RecordEngagementTime(base::TimeDelta engagement_time) override;
};

}  // namespace ash

#endif  // ASH_AMBIENT_METRICS_MANAGED_SCREENSAVER_METRICS_H_