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" |
(...skipping 10 matching lines...) Expand all Loading... |
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. Instant is enabled with preloading for the EXPERIMENT | 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 // groups. It remains disabled, as is default, for the CONTROL groups. |
24 // | 24 // |
25 // INSTANT_EXPERIMENT: Queries are issued as the user types, and previews are | 25 // INSTANT_EXPERIMENT: Queries are issued as the user types, and previews are |
26 // shown. 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 |
27 // bounced back to INACTIVE. | 27 // bounced back to INACTIVE. |
28 // | 28 // |
29 // HIDDEN_EXPERIMENT: Queries are issued as the user types, but no preview is | 29 // HIDDEN_EXPERIMENT: Queries are issued as the user types, but no preview is |
30 // shown until they press <Enter>. If the user hasn't opted to send metrics | 30 // shown until they press <Enter>. If the user hasn't opted to send metrics |
31 // (UMA) data, they are bounced back to INACTIVE. | 31 // (UMA) data, they are bounced back to INACTIVE. Suggestions obtained from |
| 32 // Instant are not propagated back to the omnibox. |
32 // | 33 // |
33 // SILENT_EXPERIMENT: No queries are issued until the user presses <Enter>. No | 34 // SILENT_EXPERIMENT: No queries are issued until the user presses <Enter>. No |
34 // previews are shown. The user is not required to send metrics (UMA) data. | 35 // previews are shown. The user is not required to send metrics (UMA) data. |
35 // | 36 // |
| 37 // SUGGEST_EXPERIMENT: Same as HIDDEN, except that the Instant suggestions are |
| 38 // autocompleted inline into the omnibox. |
| 39 // |
36 // UMA_CONTROL: Instant is disabled. If the user hasn't opted to send metrics | 40 // UMA_CONTROL: Instant is disabled. If the user hasn't opted to send metrics |
37 // (UMA) data, they are bounced back to INACTIVE. | 41 // (UMA) data, they are bounced back to INACTIVE. |
38 // | 42 // |
39 // ALL_CONTROL: Instant is disabled. The user is not required to send metrics | 43 // ALL_CONTROL: Instant is disabled. The user is not required to send metrics |
40 // (UMA) data. | 44 // (UMA) data. |
41 // | 45 // |
42 // Users not chosen into any of the above groups are INACTIVE. | 46 // Users not chosen into any of the above groups are INACTIVE. |
43 // | 47 // |
44 // Each non-INACTIVE group is split into two equal subgroups, to detect bias | 48 // Each non-INACTIVE group is split into two equal subgroups, to detect bias |
45 // between them when analyzing metrics. The subgroups are denoted by "_A" and | 49 // between them when analyzing metrics. The subgroups are denoted by "_A" and |
46 // "_B" suffixes, and are treated identically for all other purposes. | 50 // "_B" suffixes, and are treated identically for all other purposes. |
47 class InstantFieldTrial { | 51 class InstantFieldTrial { |
48 public: | 52 public: |
49 enum Group { | 53 enum Group { |
50 INACTIVE, | 54 INACTIVE, |
51 | 55 |
52 INSTANT_EXPERIMENT_A, | 56 INSTANT_EXPERIMENT_A, |
53 INSTANT_EXPERIMENT_B, | 57 INSTANT_EXPERIMENT_B, |
| 58 |
54 HIDDEN_EXPERIMENT_A, | 59 HIDDEN_EXPERIMENT_A, |
55 HIDDEN_EXPERIMENT_B, | 60 HIDDEN_EXPERIMENT_B, |
| 61 |
56 SILENT_EXPERIMENT_A, | 62 SILENT_EXPERIMENT_A, |
57 SILENT_EXPERIMENT_B, | 63 SILENT_EXPERIMENT_B, |
58 | 64 |
| 65 SUGGEST_EXPERIMENT_A, |
| 66 SUGGEST_EXPERIMENT_B, |
| 67 |
59 UMA_CONTROL_A, | 68 UMA_CONTROL_A, |
60 UMA_CONTROL_B, | 69 UMA_CONTROL_B, |
| 70 |
61 ALL_CONTROL_A, | 71 ALL_CONTROL_A, |
62 ALL_CONTROL_B, | 72 ALL_CONTROL_B, |
63 }; | 73 }; |
64 | 74 |
65 // Activate the field trial. Before this call, all calls to GetGroup will | 75 // Activate the field trial. Before this call, all calls to GetGroup will |
66 // return INACTIVE. *** MUST NOT BE CALLED MORE THAN ONCE. *** | 76 // return INACTIVE. *** MUST NOT BE CALLED MORE THAN ONCE. *** |
67 static void Activate(); | 77 static void Activate(); |
68 | 78 |
69 // Return the field trial group this profile belongs to. | 79 // Return the field trial group this profile belongs to. |
70 static Group GetGroup(Profile* profile); | 80 static Group GetGroup(Profile* profile); |
71 | 81 |
72 // Check if the user is in any of the EXPERIMENT groups. | 82 // Check if the user is in any of the EXPERIMENT groups. |
73 static bool IsInstantExperiment(Profile* profile); | 83 static bool IsInstantExperiment(Profile* profile); |
74 | 84 |
75 // Check if the user is in the HIDDEN or SILENT EXPERIMENT groups. | 85 // Check if the user is in the HIDDEN, SILENT or SUGGEST EXPERIMENT groups. |
76 static bool IsHiddenExperiment(Profile* profile); | 86 static bool IsHiddenExperiment(Profile* profile); |
77 | 87 |
78 // Check if the user is in the SILENT EXPERIMENT group. | 88 // Check if the user is in the SILENT EXPERIMENT group. |
79 static bool IsSilentExperiment(Profile* profile); | 89 static bool IsSilentExperiment(Profile* profile); |
80 | 90 |
81 // Returns a string describing the user's group. Can be added to histogram | 91 // Returns a string describing the user's group. Can be added to histogram |
82 // names, to split histograms by field trial groups. | 92 // names, to split histograms by field trial groups. |
83 static std::string GetGroupName(Profile* profile); | 93 static std::string GetGroupName(Profile* profile); |
84 | 94 |
85 // Returns a string denoting the user's group, for adding as a URL param. | 95 // Returns a string denoting the user's group, for adding as a URL param. |
86 static std::string GetGroupAsUrlParam(Profile* profile); | 96 static std::string GetGroupAsUrlParam(Profile* profile); |
87 | 97 |
| 98 // Returns whether the Instant suggested text should be autocompleted inline |
| 99 // into the omnibox. |
| 100 static bool ShouldSetSuggestedText(Profile* profile); |
| 101 |
88 private: | 102 private: |
89 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); | 103 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); |
90 }; | 104 }; |
91 | 105 |
92 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 106 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
OLD | NEW |