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
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98

ash / scanner / scanner_metrics.h [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.

#ifndef ASH_SCANNER_SCANNER_METRICS_H_
#define ASH_SCANNER_SCANNER_METRICS_H_

#include <string_view>

#include "ash/ash_export.h"
#include "base/time/time.h"

namespace ash {

inline constexpr std::string_view
    kScannerFeatureTimerExecutePopulatedNewCalendarEventAction =
        "Ash.ScannerFeature.Timer.ExecutePopulatedNewCalendarEventAction";

inline constexpr std::string_view
    kScannerFeatureTimerExecutePopulatedNewContactAction =
        "Ash.ScannerFeature.Timer.ExecutePopulatedNewContactAction";

inline constexpr std::string_view
    kScannerFeatureTimerExecutePopulatedNewGoogleSheetAction =
        "Ash.ScannerFeature.Timer.ExecutePopulatedNewGoogleSheetAction";

inline constexpr std::string_view
    kScannerFeatureTimerExecutePopulatedNewGoogleDocAction =
        "Ash.ScannerFeature.Timer.ExecutePopulatedNewGoogleDocAction";

inline constexpr std::string_view
    kScannerFeatureTimerExecutePopulatedNewCopyToClipboardAction =
        "Ash.ScannerFeature.Timer.ExecutePopulatedNewCopyToClipboardAction";

inline constexpr std::string_view kScannerFeatureTimerFetchActionsForImage =
    "Ash.ScannerFeature.Timer.FetchActionsForImage";

inline constexpr std::string_view
    kScannerFeatureTimerPopulateNewCalendarEventAction =
        "Ash.ScannerFeature.Timer.PopulateNewCalendarEventAction";

inline constexpr std::string_view kScannerFeatureTimerPopulateNewContactAction =
    "Ash.ScannerFeature.Timer.PopulateNewContactAction";

inline constexpr std::string_view
    kScannerFeatureTimerPopulateNewGoogleSheetAction =
        "Ash.ScannerFeature.Timer.PopulateNewGoogleSheetAction";

inline constexpr std::string_view
    kScannerFeatureTimerPopulateNewGoogleDocAction =
        "Ash.ScannerFeature.Timer.PopulateNewGoogleDocAction";

inline constexpr std::string_view
    kScannerFeatureTimerPopulateNewCopyToClipboardAction =
        "Ash.ScannerFeature.Timer.PopulateNewCopyToClipboardAction";

// Enum for histogram. Stores what state the user is in.
// LINT.IfChange(ScannerFeatureUserState)
enum class ScannerFeatureUserState {
  kConsentDisclaimerAccepted,
  kConsentDisclaimerRejected,
  kSunfishScreenEnteredViaShortcut,
  kSunfishScreenInitialScreenCaptureSentToScannerServer,
  kScreenCaptureModeScannerButtonShown,
  kScreenCaptureModeInitialScreenCaptureSentToScannerServer,
  kNoActionsDetected,
  kNewCalendarEventActionDetected,
  kNewCalendarEventActionFinishedSuccessfully,
  kNewCalendarEventActionPopulationFailed,
  kNewContactActionDetected,
  kNewContactActionFinishedSuccessfully,
  kNewContactActionPopulationFailed,
  kNewGoogleSheetActionDetected,
  kNewGoogleSheetActionFinishedSuccessfully,
  kNewGoogleSheetActionPopulationFailed,
  kNewGoogleDocActionDetected,
  kNewGoogleDocActionFinishedSuccessfully,
  kNewGoogleDocActionPopulationFailed,
  kCopyToClipboardActionDetected,
  kCopyToClipboardActionFinishedSuccessfully,
  kCopyToClipboardActionPopulationFailed,
  kNewCalendarEventPopulatedActionExecutionFailed,
  kNewContactPopulatedActionExecutionFailed,
  kNewGoogleSheetPopulatedActionExecutionFailed,
  kNewGoogleDocPopulatedActionExecutionFailed,
  kCopyToClipboardPopulatedActionExecutionFailed,
  kMaxValue = kCopyToClipboardPopulatedActionExecutionFailed,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/ash/enums.xml:ScannerFeatureUserState)

ASH_EXPORT void RecordScannerFeatureUserState(ScannerFeatureUserState state);

ASH_EXPORT void RecordOnDeviceOcrTimerCompleted(
    base::TimeTicks ocr_attempt_start_time);

}  // namespace ash

#endif  // ASH_SCANNER_SCANNER_METRICS_H_