Chromium Code Reviews| Index: ash/metrics/user_metrics_recorder.h |
| diff --git a/ash/metrics/user_metrics_recorder.h b/ash/metrics/user_metrics_recorder.h |
| index da39a1063c89f0923feafa03646277d667b74631..d7cb703fc4c7eecde2b0ce8fa82c4f6ce5c592e2 100644 |
| --- a/ash/metrics/user_metrics_recorder.h |
| +++ b/ash/metrics/user_metrics_recorder.h |
| @@ -10,6 +10,10 @@ |
| namespace ash { |
| +namespace test { |
| +class UserMetricsRecorderTestAPI; |
| +} |
| + |
| enum UserMetricsAction { |
| UMA_ACCEL_EXIT_FIRST_Q, |
| UMA_ACCEL_EXIT_SECOND_Q, |
| @@ -127,14 +131,40 @@ enum UserMetricsAction { |
| // (RecordUserMetricsAction) are passed through the UserMetricsRecorder. |
| class ASH_EXPORT UserMetricsRecorder { |
| public: |
| + // Creates a UserMetricsRecorder that records metrics periodically. Equivalent |
| + // to calling UserMetricsRecorder(true). |
| UserMetricsRecorder(); |
| - ~UserMetricsRecorder(); |
| + virtual ~UserMetricsRecorder(); |
| + |
| + // Records an Ash owned user action. |
| void RecordUserMetricsAction(ash::UserMetricsAction action); |
| + |
| private: |
| + friend class test::UserMetricsRecorderTestAPI; |
| + |
| + // Creates a UserMetricsRecorder and will only record periodic metrics if |
| + // |record_periodic_metrics| is true. This is useful for tests that do not |
| + // want the timer to be started. |
|
oshima
2015/04/25 01:06:58
can you be more explicit that this is for test? li
bruthig
2015/04/27 15:22:21
Done.
|
| + // TODO(bruthig): Add a constructor that accepts a base::RepeatingTimer so |
| + // that tests can inject a test double that can be controlled by the test. The |
| + // missing piece is a suitable base::RepeatingTimer test double. |
| + explicit UserMetricsRecorder(bool record_periodic_metrics); |
| + |
| + // Records UMA metrics. Invoked periodically by the |timer_|. |
| void RecordPeriodicMetrics(); |
| + // Returns true if the user's session is active and the user is in a multi |
| + // window environment. |
|
oshima
2015/04/25 01:06:58
"multi window environment" sounds a bit odd. how a
bruthig
2015/04/27 15:22:21
Done.
|
| + bool IsUserActiveInMultiWindowEnvironment() const; |
| + |
| + // Starts the |timer_| and binds it to |RecordPeriodicMetrics|. |
| + void StartTimer(); |
| + |
| + // The periodic timer that triggers metrics to be recorded. |
| base::RepeatingTimer<UserMetricsRecorder> timer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UserMetricsRecorder); |
| }; |
| } // namespace ash |