interacted_by_tap_recorder.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2018 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_SYSTEM_TRAY_INTERACTED_BY_TAP_RECORDER_H_
  5. #define ASH_SYSTEM_TRAY_INTERACTED_BY_TAP_RECORDER_H_
  6. #include "ui/events/event_handler.h"
  7. namespace views {
  8. class View;
  9. } // namespace views
  10. namespace ash {
  11. // An event handler that will be installed as system tray view PreTargetHandler
  12. // to record Interaction metrics.
  13. class InteractedByTapRecorder : public ui::EventHandler {
  14. public:
  15. explicit InteractedByTapRecorder(views::View* target_view);
  16. InteractedByTapRecorder(const InteractedByTapRecorder&) = delete;
  17. InteractedByTapRecorder& operator=(const InteractedByTapRecorder&) = delete;
  18. ~InteractedByTapRecorder() override = default;
  19. // Type of interaction. This enum is used to back an UMA histogram and should
  20. // be treated as append-only.
  21. enum InteractionType {
  22. INTERACTION_TYPE_TAP = 0,
  23. INTERACTION_TYPE_CLICK,
  24. INTERACTION_TYPE_COUNT
  25. };
  26. private:
  27. // ui::EventHandler:
  28. void OnEvent(ui::Event* event) override;
  29. };
  30. } // namespace ash
  31. #endif // ASH_SYSTEM_TRAY_INTERACTED_BY_TAP_RECORDER_H_