desktop_task_switch_metric_recorder.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2015 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_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_
  5. #define ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_
  6. #include "ash/ash_export.h"
  7. #include "ui/wm/public/activation_change_observer.h"
  8. namespace ash {
  9. // Tracks metrics for task switches caused by the user activating a task window
  10. // by clicking or tapping on it.
  11. class ASH_EXPORT DesktopTaskSwitchMetricRecorder
  12. : public ::wm::ActivationChangeObserver {
  13. public:
  14. DesktopTaskSwitchMetricRecorder();
  15. DesktopTaskSwitchMetricRecorder(const DesktopTaskSwitchMetricRecorder&) =
  16. delete;
  17. DesktopTaskSwitchMetricRecorder& operator=(
  18. const DesktopTaskSwitchMetricRecorder&) = delete;
  19. ~DesktopTaskSwitchMetricRecorder() override;
  20. // wm::ActivationChangeObserver:
  21. void OnWindowActivated(
  22. ::wm::ActivationChangeObserver::ActivationReason reason,
  23. aura::Window* gained_active,
  24. aura::Window* lost_active) override;
  25. private:
  26. // Tracks the last active task window.
  27. aura::Window* last_active_task_window_;
  28. };
  29. } // namespace ash
  30. #endif // ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_