pointer_metrics_recorder.h 4.3 KB

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