1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_ASH_METRICS_POINTER_METRICS_RECORDER_H_ 6 #define UI_ASH_METRICS_POINTER_METRICS_RECORDER_H_ 7 8 #include "ash/ash_export.h" 9 #include "base/macros.h" 10 #include "ui/events/event_handler.h" 11 12 namespace ash { 13 14 // Form factor of the down event. 15 // This enum is used to control a UMA histogram buckets. If you change this 16 // enum, you should update DownEventMetric as well. 17 enum class DownEventFormFactor { 18 kClamshell = 0, 19 kTabletModeLandscape, 20 kTabletModePortrait, 21 kFormFactorCount, 22 }; 23 24 // Input type of the down event. 25 // This enum is used to control a UMA histogram buckets. If you change this 26 // enum, you should update DownEventMetric as well. 27 enum class DownEventSource { 28 kUnknown = 0, // Deprecated, never occurs in practice. 29 kMouse, 30 kStylus, 31 kTouch, 32 kSourceCount, 33 }; 34 35 // App type (Destination), Input and FormFactor Combination of the down event. 36 // This enum is used to back an UMA histogram and new values should 37 // be inserted immediately above kMaxValue. 38 enum class DownEventMetric2 { 39 // All "Unknown" types are deprecated, never occur in practice. 40 kNonAppUnknownClamshell = 0, 41 kNonAppUnknownTabletLandscape = 1, 42 kNonAppUnknownTabletPortrait = 2, 43 kNonAppMouseClamshell = 3, 44 kNonAppMouseTabletLandscape = 4, 45 kNonAppMouseTabletPortrait = 5, 46 kNonAppStylusClamshell = 6, 47 kNonAppStylusTabletLandscape = 7, 48 kNonAppStylusTabletPortrait = 8, 49 kNonAppTouchClamshell = 9, 50 kNonAppTouchTabletLandscape = 10, 51 kNonAppTouchTabletPortrait = 11, 52 kBrowserUnknownClamshell = 12, 53 kBrowserUnknownTabletLandscape = 13, 54 kBrowserUnknownTabletPortrait = 14, 55 kBrowserMouseClamshell = 15, 56 kBrowserMouseTabletLandscape = 16, 57 kBrowserMouseTabletPortrait = 17, 58 kBrowserStylusClamshell = 18, 59 kBrowserStylusTabletLandscape = 19, 60 kBrowserStylusTabletPortrait = 20, 61 kBrowserTouchClamshell = 21, 62 kBrowserTouchTabletLandscape = 22, 63 kBrowserTouchTabletPortrait = 23, 64 kChromeAppUnknownClamshell = 24, 65 kChromeAppUnknownTabletLandscape = 25, 66 kChromeAppUnknownTabletPortrait = 26, 67 kChromeAppMouseClamshell = 27, 68 kChromeAppMouseTabletLandscape = 28, 69 kChromeAppMouseTabletPortrait = 29, 70 kChromeAppStylusClamshell = 30, 71 kChromeAppStylusTabletLandscape = 31, 72 kChromeAppStylusTabletPortrait = 32, 73 kChromeAppTouchClamshell = 33, 74 kChromeAppTouchTabletLandscape = 34, 75 kChromeAppTouchTabletPortrait = 35, 76 kArcAppUnknownClamshell = 36, 77 kArcAppUnknownTabletLandscape = 37, 78 kArcAppUnknownTabletPortrait = 38, 79 kArcAppMouseClamshell = 39, 80 kArcAppMouseTabletLandscape = 40, 81 kArcAppMouseTabletPortrait = 41, 82 kArcAppStylusClamshell = 42, 83 kArcAppStylusTabletLandscape = 43, 84 kArcAppStylusTabletPortrait = 44, 85 kArcAppTouchClamshell = 45, 86 kArcAppTouchTabletLandscape = 46, 87 kArcAppTouchTabletPortrait = 47, 88 kCrostiniAppUnknownClamshell = 48, 89 kCrostiniAppUnknownTabletLandscape = 49, 90 kCrostiniAppUnknownTabletPortrait = 50, 91 kCrostiniAppMouseClamshell = 51, 92 kCrostiniAppMouseTabletLandscape = 52, 93 kCrostiniAppMouseTabletPortrait = 53, 94 kCrostiniAppStylusClamshell = 54, 95 kCrostiniAppStylusTabletLandscape = 55, 96 kCrostiniAppStylusTabletPortrait = 56, 97 kCrostiniAppTouchClamshell = 57, 98 kCrostiniAppTouchTabletLandscape = 58, 99 kCrostiniAppTouchTabletPortrait = 59, 100 kSystemAppUnknownClamshell = 60, 101 kSystemAppUnknownTabletLandscape = 61, 102 kSystemAppUnknownTabletPortrait = 62, 103 kSystemAppMouseClamshell = 63, 104 kSystemAppMouseTabletLandscape = 64, 105 kSystemAppMouseTabletPortrait = 65, 106 kSystemAppStylusClamshell = 66, 107 kSystemAppStylusTabletLandscape = 67, 108 kSystemAppStylusTabletPortrait = 68, 109 kSystemAppTouchClamshell = 69, 110 kSystemAppTouchTabletLandscape = 70, 111 kSystemAppTouchTabletPortrait = 71, 112 kMaxValue = kSystemAppTouchTabletPortrait 113 }; 114 115 // A metrics recorder that records pointer related metrics. 116 class ASH_EXPORT PointerMetricsRecorder : public ui::EventHandler { 117 public: 118 PointerMetricsRecorder(); 119 ~PointerMetricsRecorder() override; 120 121 // ui::EventHandler: 122 void OnMouseEvent(ui::MouseEvent* event) override; 123 void OnTouchEvent(ui::TouchEvent* event) override; 124 125 private: 126 DISALLOW_COPY_AND_ASSIGN(PointerMetricsRecorder); 127 }; 128 129 } // namespace ash 130 131 #endif // UI_ASH_METRICS_POINTER_METRICS_RECORDER_H_ 132