File: arc_input_overlay_metrics.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (150 lines) | stat: -rw-r--r-- 5,296 bytes parent folder | download | duplicates (5)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// 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 CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_
#define CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_

#include <string>

#include "chrome/browser/ash/arc/input_overlay/constants.h"

namespace arc::input_overlay {

inline constexpr char kEditingListFunctionTriggeredHistogram[] =
    "EditingListFunctionTriggered";
inline constexpr char kButtonOptionsMenuFunctionTriggeredHistogram[] =
    "ButtonOptionsMenuFunctionTriggered";
inline constexpr char kEditDeleteMenuFunctionTriggeredHistogram[] =
    "EditDeleteMenuFuctionTriggered";

inline constexpr char kToggleWithMappingSourceHistogram[] =
    "ToggleWithMappingSource";

inline constexpr char kPlayGameWithGameControlsHistogram[] =
    "PlayGameWithGameControls";

inline constexpr char kToggleOnHistogramName[] = "On";
inline constexpr char kToggleOffHistogramName[] = "Off";

inline constexpr char kFeatureHistogramName[] = "Feature";
inline constexpr char kHintHistogramName[] = "Hint";

inline constexpr char kGameControlsHistogramSeparator[] = ".";

// This enum should be kept in sync with the
// `GameControlsButtonOptionsMenuFunction` in
// tools/metrics/histograms/enums.xml.
enum class ButtonOptionsMenuFunction {
  kOptionSingleButton,
  kOptionJoystick,
  kEditLabelFocused,
  kKeyAssigned,
  kDone,
  kDelete,
  kMaxValue = kDelete,
};

// This enum should be kept in sync with the
// `GameControlsEditDeleteMenuFunction` in
// tools/metrics/histograms/enums.xml.
enum class EditDeleteMenuFunction {
  kEdit,
  kDelete,
  kMaxValue = kDelete,
};

// This enum should be kept in sync with the `GameControlsEditingListFunction`
// in tools/metrics/histograms/enums.xml.
enum class EditingListFunction {
  kAdd,
  kDone,
  kHoverListItem,
  kPressListItem,
  kEditLabelFocused,
  kKeyAssigned,
  kMaxValue = kKeyAssigned,
};

// This enum should be kept in sync with the `GameControlsMappingSource`
// in tools/metrics/histograms/enums.xml.
enum class MappingSource {
  kEmpty,
  // Only pre-defined default mapping. May include position change.
  kDefault,
  // Only user-added mapping.
  kUserAdded,
  // Includes default and user-added mapping.
  kDefaultAndUserAdded,
  kMaxValue = kDefaultAndUserAdded,
};

// This enum should be kept in sync with the `GameControlsToggleFunction`
// in tools/metrics/histograms/enums.xml.
enum class GameControlsToggleFunction {
  kFeature,
  kMappingHint,
  kMaxValue = kMappingHint,
};

std::string BuildGameControlsHistogramName(const std::string& name);

std::string BuildGameControlsUkmEventName(const std::string& name);

// Records whether the feature is on or off.
void RecordInputOverlayFeatureState(const std::string& package_name,
                                    bool enable);

// Records whether the mapping hint is on or off.
void RecordInputOverlayMappingHintState(const std::string& package_name,
                                        bool enable);

// Records whether the overlay is customized.
void RecordInputOverlayCustomizedUsage(const std::string& package_name);

// Record when finishing action dragging or releasing arrow key.
void RecordInputOverlayActionReposition(const std::string& package_name,
                                        RepositionType reposition_type,
                                        InputOverlayWindowStateType state_type);

// Record when finishing menu entry dragging or releasing arrow key.
void RecordInputOverlayMenuEntryReposition(
    const std::string& package_name,
    RepositionType reposition_type,
    InputOverlayWindowStateType state_type);

// Record when finishing button group dragging or releasing arrow key.
void RecordInputOverlayButtonGroupReposition(
    const std::string& package_name,
    RepositionType reposition_type,
    InputOverlayWindowStateType state_type);

void RecordEditingListFunctionTriggered(const std::string& package_name,
                                        EditingListFunction function);

void RecordButtonOptionsMenuFunctionTriggered(
    const std::string& package_name,
    ButtonOptionsMenuFunction function);

void RecordEditDeleteMenuFunctionTriggered(const std::string& package_name,
                                           EditDeleteMenuFunction function);

// Records feature toggle data if `is_feature` is true. Otherwise, records the
// hint toggle data.
void RecordToggleWithMappingSource(const std::string& package_name,
                                   bool is_feature,
                                   bool is_on,
                                   MappingSource source);

// Records whether the game was played with the Game Controls feature. This
// event is logged once per game session.
// - If the user uses Game Controls for the first time in a session,
// `played_with_game_controls` is set to true.
// - Otherwise, the event is logged when the game shuts down, with
// `played_with_game_controls` set to false.
void RecordPlayGameWithGameControls(const std::string& package_name,
                                    bool played_with_game_controls);

}  // namespace arc::input_overlay

#endif  // CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_ARC_INPUT_OVERLAY_METRICS_H_