[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 1 | // Copyright (c) 2012 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 | |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
| 6 | #define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 7 | |
| 8 | #include <string> |
[email protected] | fea6d30 | 2013-04-13 02:04:06 | [diff] [blame] | 9 | #include <vector> |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 10 | |
| 11 | #include "base/basictypes.h" |
| 12 | |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame] | 13 | // This class manages the Omnibox field trials. |
| 14 | class OmniboxFieldTrial { |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 15 | public: |
[email protected] | dc1f854 | 2013-01-30 05:10:29 | [diff] [blame] | 16 | // Creates the static field trial groups. |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 17 | // *** MUST NOT BE CALLED MORE THAN ONCE. *** |
[email protected] | dc1f854 | 2013-01-30 05:10:29 | [diff] [blame] | 18 | static void ActivateStaticTrials(); |
| 19 | |
| 20 | // Activates all dynamic field trials. The main difference between |
| 21 | // the autocomplete dynamic and static field trials is that the former |
| 22 | // don't require any code changes on the Chrome side as they are controlled |
| 23 | // on the server side. Chrome binary simply propagates all necessary |
| 24 | // information through the X-Chrome-Variations header. |
| 25 | // This method, unlike ActivateStaticTrials(), may be called multiple times. |
| 26 | static void ActivateDynamicTrials(); |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 27 | |
[email protected] | 5fc1217c | 2013-02-12 21:25:19 | [diff] [blame] | 28 | // Returns a bitmap containing AutocompleteProvider::Type values |
| 29 | // that should be disabled in AutocompleteController. |
| 30 | // This method simply goes over all autocomplete dynamic field trial groups |
| 31 | // and looks for group names like "ProvidersDisabled_NNN" where NNN is |
| 32 | // an integer corresponding to a bitmap mask. All extracted bitmaps |
| 33 | // are OR-ed together and returned as the final result. |
| 34 | static int GetDisabledProviderTypes(); |
| 35 | |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 36 | // --------------------------------------------------------- |
[email protected] | 032d5e6c | 2012-02-17 17:53:55 | [diff] [blame] | 37 | // For the inline History Quick Provider field trial. |
| 38 | |
| 39 | // Returns whether the user is in any field trial group for this |
| 40 | // field trial. False indicates that the field trial wasn't |
| 41 | // successfully created for some reason. |
| 42 | static bool InDisallowInlineHQPFieldTrial(); |
| 43 | |
| 44 | // Returns whether the user should get the experiment setup or |
| 45 | // the default setup for this field trial. The experiment |
| 46 | // group prohibits inlining suggestions. |
| 47 | static bool InDisallowInlineHQPFieldTrialExperimentGroup(); |
| 48 | |
[email protected] | f5b95ba9 | 2012-03-27 14:05:19 | [diff] [blame] | 49 | // --------------------------------------------------------- |
[email protected] | 618d6e6 | 2012-12-16 05:55:57 | [diff] [blame] | 50 | // For the suggest field trial. |
| 51 | |
[email protected] | fea6d30 | 2013-04-13 02:04:06 | [diff] [blame] | 52 | // Populates |field_trial_hash| with hashes of the active suggest field trial |
| 53 | // names, if any. |
| 54 | static void GetActiveSuggestFieldTrialHashes( |
| 55 | std::vector<uint32>* field_trial_hash); |
[email protected] | 618d6e6 | 2012-12-16 05:55:57 | [diff] [blame] | 56 | |
| 57 | // --------------------------------------------------------- |
[email protected] | 9bfc2c8 | 2013-05-03 22:15:21 | [diff] [blame] | 58 | // For the HistoryQuick provider field trial that combines replacing |
| 59 | // the HistoryURL provider and turning on "new scoring" in HistoryQuick |
| 60 | // provider. |
[email protected] | 8ad29cc3 | 2012-06-15 19:44:31 | [diff] [blame] | 61 | |
[email protected] | 9bfc2c8 | 2013-05-03 22:15:21 | [diff] [blame] | 62 | // Returns whether the user should get "new scoring" in HistoryQuick |
| 63 | // provider or the default scoring. "New scoring" is based on the |
| 64 | // frequency of recent visits to the URL, a.k.a. "frecency" |
| 65 | // scoring). |
| 66 | static bool InHQPNewScoringExperimentGroup(); |
[email protected] | 8ad29cc3 | 2012-06-15 19:44:31 | [diff] [blame] | 67 | |
[email protected] | 9bfc2c8 | 2013-05-03 22:15:21 | [diff] [blame] | 68 | // Returns whether the user experiment the replace HUP behavior or |
| 69 | // the default behavior. The experiment group simultaneously |
| 70 | // disables HistoryURL provider from searching the URL database and |
| 71 | // directs HistoryQuick provider to calculate both HUP-style and |
| 72 | // HQP-style scores for matches, then return whichever is larger. |
| 73 | static bool InHQPReplaceHUPScoringExperimentGroup(); |
[email protected] | 8ad29cc3 | 2012-06-15 19:44:31 | [diff] [blame] | 74 | |
[email protected] | 44025cf2 | 2012-09-25 22:43:31 | [diff] [blame] | 75 | // --------------------------------------------------------- |
| 76 | // For the HistoryURL provider disable culling redirects field trial. |
| 77 | |
| 78 | // Returns whether the user is in any group for this field trial. |
[email protected] | ed5fec21 | 2012-09-29 14:05:29 | [diff] [blame] | 79 | // (Should always be true unless initialization went wrong.) |
[email protected] | 44025cf2 | 2012-09-25 22:43:31 | [diff] [blame] | 80 | static bool InHUPCullRedirectsFieldTrial(); |
| 81 | |
| 82 | // Returns whether we should disable culling of redirects in |
| 83 | // HistoryURL provider. |
| 84 | static bool InHUPCullRedirectsFieldTrialExperimentGroup(); |
| 85 | |
[email protected] | ed5fec21 | 2012-09-29 14:05:29 | [diff] [blame] | 86 | // --------------------------------------------------------- |
| 87 | // For the HistoryURL provider disable creating a shorter match |
| 88 | // field trial. |
| 89 | |
| 90 | // Returns whether the user is in any group for this field trial. |
| 91 | // (Should always be true unless initialization went wrong.) |
| 92 | static bool InHUPCreateShorterMatchFieldTrial(); |
| 93 | |
| 94 | // Returns whether we should disable creating a shorter match in |
| 95 | // HistoryURL provider. |
| 96 | static bool InHUPCreateShorterMatchFieldTrialExperimentGroup(); |
| 97 | |
[email protected] | b88fb76 | 2012-11-10 19:10:44 | [diff] [blame] | 98 | // --------------------------------------------------------- |
[email protected] | 42f4251b | 2013-04-23 07:46:39 | [diff] [blame] | 99 | // For the AutocompleteController "stop timer" field trial. |
| 100 | |
| 101 | // Returns whether the user should get the experimental setup or the |
| 102 | // default setup for this field trial. The experiment group uses |
| 103 | // a timer in AutocompleteController to tell the providers to stop |
| 104 | // looking for matches after too much time has passed. In other words, |
| 105 | // it tries to tell the providers to stop updating the list of suggested |
| 106 | // matches if updating the matches would probably be disruptive because |
| 107 | // they're arriving so late. |
| 108 | static bool InStopTimerFieldTrialExperimentGroup(); |
| 109 | |
[email protected] | d16ad45 | 2013-05-02 22:13:18 | [diff] [blame] | 110 | // --------------------------------------------------------- |
| 111 | // For the ZeroSuggestProvider field trial. |
| 112 | |
| 113 | // Returns whether the user is in any field trial where the |
| 114 | // ZeroSuggestProvider should be used to get suggestions when the |
| 115 | // user clicks on the omnibox but has not typed anything yet. |
| 116 | static bool InZeroSuggestFieldTrial(); |
| 117 | |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 118 | private: |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame] | 119 | DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 120 | }; |
| 121 | |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame] | 122 | #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |