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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/BUILD.gn ('k') | chrome/installer/util/experiment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/experiment.h
diff --git a/chrome/installer/util/experiment.h b/chrome/installer/util/experiment.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc75f1e437a1d585274729d515a363b1724e544b
--- /dev/null
+++ b/chrome/installer/util/experiment.h
@@ -0,0 +1,96 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_INSTALLER_UTIL_EXPERIMENT_H_
+#define CHROME_INSTALLER_UTIL_EXPERIMENT_H_
+
+#include "base/time/time.h"
+#include "chrome/installer/util/experiment_metrics.h"
+
+namespace installer {
+
+class ExperimentStorage;
+
+// The experiment state for the current user. Experiment state is a combination
+// of the per-install ExperimentMetrics and the per-user experiment data.
+class Experiment {
+ public:
+ Experiment();
+ Experiment(Experiment&&);
+ Experiment(const Experiment&);
+ ~Experiment();
+ Experiment& operator=(Experiment&&) = default;
+ Experiment& operator=(const Experiment&) = default;
+
+ // Initializes this instance based on |metrics|.
+ void InitializeFromMetrics(const ExperimentMetrics& metrics);
+
+ // Moves this user into |state|, updating metrics as appropriate.
+ void SetState(ExperimentMetrics::State state);
+
+ // Assigns this user to |group|.
+ void AssignGroup(int group);
+
+ // Setters for storing data relating to experiment. These should only be
+ // called if the experiment is between initial and terminal states.
+
+ // Fill toast location value.
+ void SetToastLocation(ExperimentMetrics::ToastLocation location);
+
+ // Fill number of days user was inactive before toast was shown.
+ void SetInactiveDays(int days);
+
+ // Fill number of times toast was displayed.
+ void SetToastCount(int count);
+
+ // Fill fine grained timestamp for first time the toast was shown.
+ void SetDisplayTime(base::Time time);
+
+ // Time delta between user session start and toast display.
+ void SetUserSessionUptime(base::TimeDelta time_delta);
+
+ // Time delta between toast display and action taken on toast display.
+ void SetActionDelay(base::TimeDelta time_delta);
+
+ const ExperimentMetrics& metrics() const { return metrics_; }
+
+ ExperimentMetrics::State state() const { return state_; }
+
+ int group() const { return group_; }
+
+ ExperimentMetrics::ToastLocation toast_location() const {
+ return toast_location_;
+ }
+
+ int inactive_days() const { return inactive_days_; }
+
+ int toast_count() const { return toast_count_; }
+
+ base::Time first_display_time() const { return first_display_time_; }
+
+ base::Time latest_display_time() const { return latest_display_time_; }
+
+ base::TimeDelta user_session_uptime() const { return user_session_uptime_; }
+
+ base::TimeDelta action_delay() const { return action_delay_; }
+
+ private:
+ friend class ExperimentStorage;
+
+ ExperimentMetrics metrics_ = ExperimentMetrics();
+ ExperimentMetrics::State state_ = ExperimentMetrics::kUninitialized;
+ int group_ = 0;
+ ExperimentMetrics::ToastLocation toast_location_ =
+ ExperimentMetrics::kOverTaskbarPin;
+ int inactive_days_ = 0;
+ int toast_count_ = 0;
+ base::Time first_display_time_;
+ base::Time latest_display_time_;
+ base::TimeDelta user_session_uptime_;
+ base::TimeDelta action_delay_;
+};
+
+} // namespace installer
+
+#endif // CHROME_INSTALLER_UTIL_EXPERIMENT_H_
« 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