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

Side by Side Diff: chrome/installer/util/experiment.h

Issue 2889323004: Win 10 Inactive toast experiment metrics and storage modifications. (Closed)
Patch Set: Apply some comments and try bots errors Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/installer/util/BUILD.gn ('k') | chrome/installer/util/experiment.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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
5 #ifndef CHROME_INSTALLER_UTIL_EXPERIMENT_H_
6 #define CHROME_INSTALLER_UTIL_EXPERIMENT_H_
7
8 #include "base/time/time.h"
9 #include "chrome/installer/util/experiment_metrics.h"
10
11 namespace installer {
12
13 class ExperimentStorage;
14
15 // The experiment state for the current user. Experiment state is a combination
16 // of the per-install ExperimentMetrics and the per-user experiment data.
17 class Experiment {
18 public:
19 Experiment();
20 Experiment(Experiment&&);
21 Experiment(const Experiment&);
22 ~Experiment();
23 Experiment& operator=(Experiment&&) = default;
24 Experiment& operator=(const Experiment&) = default;
25
26 // Initializes this instance based on |metrics|.
27 void InitializeFromMetrics(const ExperimentMetrics& metrics);
28
29 // Moves this user into |state|, updating metrics as appropriate.
30 void SetState(ExperimentMetrics::State state);
31
32 // Assigns this user to |group|.
33 void AssignGroup(int group);
34
35 // Setters for storing data relating to experiment. These should only be
36 // called if the experiment is between initial and terminal states.
37
38 // Fill toast location value.
39 void SetToastLocation(ExperimentMetrics::ToastLocation location);
40
41 // Fill number of days user was inactive before toast was shown.
42 void SetInactiveDays(int days);
43
44 // Fill number of times toast was displayed.
45 void SetToastCount(int count);
46
47 // Fill fine grained timestamp for first time the toast was shown.
48 void SetDisplayTime(base::Time time);
49
50 // Time delta between user session start and toast display.
51 void SetUserSessionUptime(base::TimeDelta time_delta);
52
53 // Time delta between toast display and action taken on toast display.
54 void SetActionDelay(base::TimeDelta time_delta);
55
56 const ExperimentMetrics& metrics() const { return metrics_; }
57
58 ExperimentMetrics::State state() const { return state_; }
59
60 int group() const { return group_; }
61
62 ExperimentMetrics::ToastLocation toast_location() const {
63 return toast_location_;
64 }
65
66 int inactive_days() const { return inactive_days_; }
67
68 int toast_count() const { return toast_count_; }
69
70 base::Time first_display_time() const { return first_display_time_; }
71
72 base::Time latest_display_time() const { return latest_display_time_; }
73
74 base::TimeDelta user_session_uptime() const { return user_session_uptime_; }
75
76 base::TimeDelta action_delay() const { return action_delay_; }
77
78 private:
79 friend class ExperimentStorage;
80
81 ExperimentMetrics metrics_ = ExperimentMetrics();
82 ExperimentMetrics::State state_ = ExperimentMetrics::kUninitialized;
83 int group_ = 0;
84 ExperimentMetrics::ToastLocation toast_location_ =
85 ExperimentMetrics::kOverTaskbarPin;
86 int inactive_days_ = 0;
87 int toast_count_ = 0;
88 base::Time first_display_time_;
89 base::Time latest_display_time_;
90 base::TimeDelta user_session_uptime_;
91 base::TimeDelta action_delay_;
92 };
93
94 } // namespace installer
95
96 #endif // CHROME_INSTALLER_UTIL_EXPERIMENT_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/BUILD.gn ('k') | chrome/installer/util/experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698