interacted_by_tap_recorder.cc 932 B

123456789101112131415161718192021222324252627
  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. #include "ash/system/tray/interacted_by_tap_recorder.h"
  5. #include "base/metrics/histogram_macros.h"
  6. #include "ui/events/event.h"
  7. #include "ui/views/view.h"
  8. namespace ash {
  9. InteractedByTapRecorder::InteractedByTapRecorder(views::View* target_view) {
  10. target_view->AddPreTargetHandler(this);
  11. }
  12. void InteractedByTapRecorder::OnEvent(ui::Event* event) {
  13. if (event->type() == ui::ET_GESTURE_TAP) {
  14. UMA_HISTOGRAM_ENUMERATION("ChromeOS.SystemTray.Interaction",
  15. INTERACTION_TYPE_TAP, INTERACTION_TYPE_COUNT);
  16. } else if (event->type() == ui::ET_MOUSE_PRESSED) {
  17. UMA_HISTOGRAM_ENUMERATION("ChromeOS.SystemTray.Interaction",
  18. INTERACTION_TYPE_CLICK, INTERACTION_TYPE_COUNT);
  19. }
  20. }
  21. } // namespace ash