OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 | 13 |
14 // This class manages the Instant field trial. | 14 // This class manages the Instant field trial. |
15 // | 15 // |
16 // If a user (profile) has an explicit preference for Instant, having disabled | 16 // If a user (profile) has an explicit preference for Instant, having disabled |
17 // or enabled it in the Preferences page, or by having a group policy override, | 17 // or enabled it in the Preferences page, or by having a group policy override, |
18 // the field trial is INACTIVE for them. There is no change in behaviour. Their | 18 // the field trial is INACTIVE for them. There is no change in behaviour. Their |
19 // Instant preference is respected. Incognito profiles are also INACTIVE. | 19 // Instant preference is respected. Incognito profiles are also INACTIVE. |
20 // | 20 // |
21 // The following mutually exclusive groups each select a small random sample of | 21 // The following mutually exclusive groups each select a small random sample of |
22 // the remaining users: | 22 // the remaining users. Instant is enabled with preloading for the EXPERIMENT |
| 23 // groups. It remains disabled, as is default, for the CONTROL groups. |
23 // | 24 // |
24 // INSTANT_EXPERIMENT: Instant is enabled, but only for search. Instant is also | 25 // INSTANT_EXPERIMENT: Queries are issued as the user types, and previews are |
25 // preloaded. If the user hasn't opted to send metrics (UMA) data, they are | 26 // shown. If the user hasn't opted to send metrics (UMA) data, they are |
26 // bounced back to INACTIVE. | 27 // bounced back to INACTIVE. |
27 // | 28 // |
28 // INSTANT_CONTROL: Instant remains disabled, as is default. If the user hasn't | 29 // HIDDEN_EXPERIMENT: Queries are issued as the user types, but no preview is |
29 // opted to send metrics (UMA) data, they are bounced back to INACTIVE. | 30 // shown until they press <Enter>. If the user hasn't opted to send metrics |
| 31 // (UMA) data, they are bounced back to INACTIVE. |
30 // | 32 // |
31 // HIDDEN_EXPERIMENT: Instant is enabled in "search only" mode, but queries are | 33 // SILENT_EXPERIMENT: No queries are issued until the user presses <Enter>. No |
32 // issued only when the user presses <Enter>. No previews are shown. | 34 // previews are shown. The user is not required to send metrics (UMA) data. |
33 // | 35 // |
34 // HIDDEN_CONTROL: Instant remains disabled, as is default. | 36 // UMA_CONTROL: Instant is disabled. If the user hasn't opted to send metrics |
| 37 // (UMA) data, they are bounced back to INACTIVE. |
| 38 // |
| 39 // ALL_CONTROL: Instant is disabled. The user is not required to send metrics |
| 40 // (UMA) data. |
35 // | 41 // |
36 // Users not chosen into any of the above groups are INACTIVE. | 42 // Users not chosen into any of the above groups are INACTIVE. |
37 // | 43 // |
38 // Each non-INACTIVE group is split into two equal subgroups, to detect bias | 44 // Each non-INACTIVE group is split into two equal subgroups, to detect bias |
39 // between them when analyzing metrics. The subgroups are denoted by "_A" and | 45 // between them when analyzing metrics. The subgroups are denoted by "_A" and |
40 // "_B" suffixes, and are treated identically for all other purposes. | 46 // "_B" suffixes, and are treated identically for all other purposes. |
41 class InstantFieldTrial { | 47 class InstantFieldTrial { |
42 public: | 48 public: |
43 enum Group { | 49 enum Group { |
44 INACTIVE, | 50 INACTIVE, |
45 | 51 |
46 INSTANT_CONTROL_A, | |
47 INSTANT_CONTROL_B, | |
48 INSTANT_EXPERIMENT_A, | 52 INSTANT_EXPERIMENT_A, |
49 INSTANT_EXPERIMENT_B, | 53 INSTANT_EXPERIMENT_B, |
50 | |
51 HIDDEN_CONTROL_A, | |
52 HIDDEN_CONTROL_B, | |
53 HIDDEN_EXPERIMENT_A, | 54 HIDDEN_EXPERIMENT_A, |
54 HIDDEN_EXPERIMENT_B, | 55 HIDDEN_EXPERIMENT_B, |
| 56 SILENT_EXPERIMENT_A, |
| 57 SILENT_EXPERIMENT_B, |
| 58 |
| 59 UMA_CONTROL_A, |
| 60 UMA_CONTROL_B, |
| 61 ALL_CONTROL_A, |
| 62 ALL_CONTROL_B, |
55 }; | 63 }; |
56 | 64 |
57 // Activate the field trial. Before this call, all calls to GetGroup will | 65 // Activate the field trial. Before this call, all calls to GetGroup will |
58 // return INACTIVE. *** MUST NOT BE CALLED MORE THAN ONCE. *** | 66 // return INACTIVE. *** MUST NOT BE CALLED MORE THAN ONCE. *** |
59 static void Activate(); | 67 static void Activate(); |
60 | 68 |
61 // Return the field trial group this profile belongs to. | 69 // Return the field trial group this profile belongs to. |
62 static Group GetGroup(Profile* profile); | 70 static Group GetGroup(Profile* profile); |
63 | 71 |
64 // Check if the user is in one of the EXPERIMENT groups. | 72 // Check if the user is in one of the EXPERIMENT groups. |
65 static bool IsExperimentGroup(Profile* profile); | 73 static bool IsExperimentGroup(Profile* profile); |
66 | 74 |
67 // Check if the user is in the INSTANT_EXPERIMENT group. | |
68 static bool IsInstantExperiment(Profile* profile); | |
69 | |
70 // Check if the user is in the HIDDEN_EXPERIMENT group. | 75 // Check if the user is in the HIDDEN_EXPERIMENT group. |
71 static bool IsHiddenExperiment(Profile* profile); | 76 static bool IsHiddenExperiment(Profile* profile); |
72 | 77 |
| 78 // Check if the user is in the SILENT EXPERIMENT group. |
| 79 static bool IsSilentExperiment(Profile* profile); |
| 80 |
73 // Returns a string describing the user's group. Can be added to histogram | 81 // Returns a string describing the user's group. Can be added to histogram |
74 // names, to split histograms by field trial groups. | 82 // names, to split histograms by field trial groups. |
75 static std::string GetGroupName(Profile* profile); | 83 static std::string GetGroupName(Profile* profile); |
76 | 84 |
77 // Returns a string denoting the user's group, for adding as a URL param. | 85 // Returns a string denoting the user's group, for adding as a URL param. |
78 static std::string GetGroupAsUrlParam(Profile* profile); | 86 static std::string GetGroupAsUrlParam(Profile* profile); |
79 | 87 |
80 private: | 88 private: |
81 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); | 89 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); |
82 }; | 90 }; |
83 | 91 |
84 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 92 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
OLD | NEW |