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
|
// 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_SYSTEM_INPUT_DEVICE_SETTINGS_INPUT_DEVICE_SETTINGS_METRICS_MANAGER_H_
#define ASH_SYSTEM_INPUT_DEVICE_SETTINGS_INPUT_DEVICE_SETTINGS_METRICS_MANAGER_H_
#include "ash/ash_export.h"
#include "ash/public/mojom/input_device_settings.mojom.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "components/account_id/account_id.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"
namespace ash {
class ASH_EXPORT InputDeviceSettingsMetricsManager {
public:
enum class PeripheralCustomizationMetricsType {
kMouse,
kGraphicsTablet,
kGraphicsTabletPen,
kMaxValue = kGraphicsTabletPen,
};
// This enum is for the ChromeOS.WelcomeExperienceCompanionAppState UMA
// histogram and should be kept in sync with the `CompanionAppState` enum in
// tools/metrics/histograms/metadata/chromeos/enums.xml.
enum class CompanionAppState {
kAvailable,
kInstalled,
kMaxValue = kInstalled,
};
// This enum is for the ChromeOS.WelcomeExperienceNotificationEvent UMA
// histogram and should be kept in sync with the
// `WelcomeExperienceNotificationEventType` enum in
// tools/metrics/histograms/metadata/chromeos/enums.xml.
enum class WelcomeExperienceNotificationEventType {
kShown,
kClicked,
kSettingChanged,
kMaxValue = kSettingChanged,
};
InputDeviceSettingsMetricsManager();
InputDeviceSettingsMetricsManager(const InputDeviceSettingsMetricsManager&) =
delete;
InputDeviceSettingsMetricsManager& operator=(
const InputDeviceSettingsMetricsManager&) = delete;
~InputDeviceSettingsMetricsManager();
void RecordKeyboardInitialMetrics(const mojom::Keyboard& keyboard);
void RecordKeyboardChangedMetrics(
const mojom::Keyboard& keyboard,
const mojom::KeyboardSettings& old_settings);
void RecordKeyboardNumberOfKeysReset(
const mojom::Keyboard& keyboard,
const mojom::KeyboardSettings& default_settings);
void RecordModifierRemappingHash(const mojom::Keyboard& keyboard);
void RecordSplitModifierRemappingHash(const mojom::Keyboard& keyboard);
void RecordSixPackKeyInfo(const mojom::Keyboard& keyboard,
ui::KeyboardCode key_code,
bool is_initial_value);
void RecordMouseInitialMetrics(const mojom::Mouse& mouse);
void RecordMouseChangedMetrics(const mojom::Mouse& mouse,
const mojom::MouseSettings& old_settings);
void RecordPointingStickInitialMetrics(
const mojom::PointingStick& pointingStick);
void RecordPointingStickChangedMetrics(
const mojom::PointingStick& pointing_stick,
const mojom::PointingStickSettings& old_settings);
void RecordTouchpadInitialMetrics(const mojom::Touchpad& touchpad);
void RecordTouchpadChangedMetrics(
const mojom::Touchpad& touchpad,
const mojom::TouchpadSettings& old_settings);
void RecordGraphicsTabletInitialMetrics(
const mojom::GraphicsTablet& graphics_tablet);
void RecordGraphicsTabletChangedMetrics(
const mojom::GraphicsTablet& graphics_tablet,
const mojom::GraphicsTabletSettings& old_settings);
void RecordKeyboardMouseComboDeviceMetric(const mojom::Keyboard& keyboard,
const mojom::Mouse& mouse);
void RecordNewButtonRegisteredMetrics(
const mojom::Button& button,
PeripheralCustomizationMetricsType peripheral_kind);
void RecordRemappingActionWhenButtonPressed(
const mojom::RemappingAction& remapping_action,
PeripheralCustomizationMetricsType peripheral_kind);
void RecordCompanionAppAvailable(const std::string& device_key);
void RecordCompanionAppInstalled(const std::string& device_key);
private:
base::flat_map<AccountId, base::flat_set<std::string>> recorded_keyboards_;
base::flat_map<AccountId, base::flat_set<std::string>> recorded_mice_;
base::flat_map<AccountId, base::flat_set<std::string>>
recorded_pointing_sticks_;
base::flat_map<AccountId, base::flat_set<std::string>> recorded_touchpads_;
base::flat_map<AccountId, base::flat_set<std::string>>
recorded_graphics_tablets_;
base::flat_map<AccountId, base::flat_set<std::string>>
recorded_companion_app_available_device_keys_;
base::flat_map<AccountId, base::flat_set<std::string>>
recorded_companion_app_installed_device_keys_;
};
} // namespace ash
#endif // ASH_SYSTEM_INPUT_DEVICE_SETTINGS_INPUT_DEVICE_SETTINGS_METRICS_MANAGER_H_
|