| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ | 5 #ifndef ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ |
| 6 #define ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ | 6 #define ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/wm/public/activation_change_observer.h" | 10 #include "ui/wm/public/activation_change_observer.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 class UserMetricsRecorder; | |
| 15 | |
| 16 // Tracks metrics for task switches caused by the user activating a task window | 14 // Tracks metrics for task switches caused by the user activating a task window |
| 17 // by clicking or tapping on it. | 15 // by clicking or tapping on it. |
| 18 class ASH_EXPORT DesktopTaskSwitchMetricRecorder | 16 class ASH_EXPORT DesktopTaskSwitchMetricRecorder |
| 19 : public aura::client::ActivationChangeObserver { | 17 : public aura::client::ActivationChangeObserver { |
| 20 public: | 18 public: |
| 21 explicit DesktopTaskSwitchMetricRecorder(); | 19 explicit DesktopTaskSwitchMetricRecorder(); |
| 22 ~DesktopTaskSwitchMetricRecorder() override; | 20 ~DesktopTaskSwitchMetricRecorder() override; |
| 23 | 21 |
| 24 // aura::client::ActivationChangeObserver: | 22 // aura::client::ActivationChangeObserver: |
| 25 void OnWindowActivated( | 23 void OnWindowActivated( |
| 26 aura::client::ActivationChangeObserver::ActivationReason reason, | 24 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 27 aura::Window* gained_active, | 25 aura::Window* gained_active, |
| 28 aura::Window* lost_active) override; | 26 aura::Window* lost_active) override; |
| 29 | 27 |
| 30 private: | 28 private: |
| 31 // Tracks the last active task window. | 29 // Tracks the last active task window. |
| 32 aura::Window* last_active_task_window_; | 30 aura::Window* last_active_task_window_; |
| 33 | 31 |
| 34 DISALLOW_COPY_AND_ASSIGN(DesktopTaskSwitchMetricRecorder); | 32 DISALLOW_COPY_AND_ASSIGN(DesktopTaskSwitchMetricRecorder); |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 } // namespace ash | 35 } // namespace ash |
| 38 | 36 |
| 39 #endif // ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ | 37 #endif // ASH_METRICS_DESKTOP_TASK_SWITCH_METRIC_RECORDER_H_ |
| OLD | NEW |