Index: chrome/browser/instant/instant_field_trial.h |
diff --git a/chrome/browser/instant/instant_field_trial.h b/chrome/browser/instant/instant_field_trial.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6dfafd761d098d21c02d76c035d306ed6af2e89c |
--- /dev/null |
+++ b/chrome/browser/instant/instant_field_trial.h |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2011 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_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
+#define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+ |
+class Profile; |
+ |
+// This class manages the Instant field trial. Each user is in exactly one of |
+// three field trial groups: Inactive, Control or Experiment. |
+// - Inactive users are those who have played with the Instant option in the |
+// Preferences page, or those for whom group policy provides an override, or |
+// those with an incognito profile, etc. The field trial is inactive for such |
+// users, so their Instant preference setting is respected. |
+// - Control and Experiment are all the other users, i.e., those who have never |
+// touched the Preferences option. Some percentage of these users are chosen |
+// into the Experiment group and get Instant enabled automatically. The rest |
+// fall into the Control group; for them, Instant remains disabled by default. |
+// - Control and Experiment are further split into two subgroups each, in order |
+// to detect bias between them (when analyzing metrics). The subgroups are |
+// treated identically for all other purposes. |
+class InstantFieldTrial { |
+ public: |
+ enum Group { |
+ INACTIVE, |
+ CONTROL1, |
+ CONTROL2, |
+ EXPERIMENT1, |
+ EXPERIMENT2, |
+ }; |
+ static Group GetGroup(Profile* profile); |
+ |
+ // Convenience method. |
+ static bool IsExperimentGroup(Profile* profile) { |
Sheridan Rawlins
2011/07/26 07:07:15
Move this to .cc too
sreeram
2011/07/26 07:36:10
Done.
|
+ Group group = GetGroup(profile); |
+ return group == EXPERIMENT1 || group == EXPERIMENT2; |
+ } |
+ |
+ // Returns a string describing the user's group. Can be added to histogram |
+ // names, to split histograms by field trial groups. |
+ static std::string GetGroupName(Profile* profile); |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); |
+}; |
+ |
+#endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |