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..9e6b5e383950fd35a929bcaca33bf926933007fe 100644 |
--- a/ash/metrics/user_metrics_recorder.h |
+++ b/ash/metrics/user_metrics_recorder.h |
@@ -127,14 +127,39 @@ enum UserMetricsAction { |
// (RecordUserMetricsAction) are passed through the UserMetricsRecorder. |
class ASH_EXPORT UserMetricsRecorder { |
public: |
+ // Creates a UserMetricsRecorder that will automatically start the repeating |
+ // timer. Equivalent to calling UserMetricsRecorder(true). |
UserMetricsRecorder(); |
- ~UserMetricsRecorder(); |
+ // Creates a UserMetricsRecorder and will only start the repeating timer if |
+ // |record_periodic_metrics| is true. This is useful for tests that do not |
+ // want the timer to be started. |
+ // 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); |
+ |
+ virtual ~UserMetricsRecorder(); |
+ |
+ // Records an Ash owned user action. |
void RecordUserMetricsAction(ash::UserMetricsAction action); |
- private: |
+ |
+ protected: |
+ // Records UMA metrics. Is invoked periodically by the |timer_|. |
void RecordPeriodicMetrics(); |
+ // Returns true if there is an active user and their session isn't currently |
+ // locked. |
+ bool UserIsActive(); |
+ |
+ private: |
+ // 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 |