Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2072)

Unified Diff: ash/metrics/user_metrics_recorder.h

Issue 1093483002: Changed when the UMA metric Ash.NumberOfVisibleWindowsInPrimaryDisplay is recorded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from patch set 2. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..578cbe8d8252c2d1358131b3c4efab39c34dbf17 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,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).
pkotwicz 2015/04/21 16:15:17 How about: "Creates a UserMetricsRecorder that rec
bruthig 2015/04/24 20:00:11 Done.
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 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);
+
+ // Records UMA metrics. Is invoked periodically by the |timer_|.
pkotwicz 2015/04/21 16:15:17 Nit: Is invoked -> Invoked
bruthig 2015/04/24 20:00:11 Done.
void RecordPeriodicMetrics();
+ // Returns true if the user sessions is active in a multi window environment.
pkotwicz 2015/04/21 16:15:17 How about: "Returns true if the user's session is
bruthig 2015/04/24 20:00:11 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

Powered by Google App Engine
This is Rietveld 408576698