[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> |
| 9 | |
| 10 | #include "base/basictypes.h" |
| 11 | |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame^] | 12 | // This class manages the Omnibox field trials. |
| 13 | class OmniboxFieldTrial { |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 14 | public: |
[email protected] | dc1f854 | 2013-01-30 05:10:29 | [diff] [blame] | 15 | // Creates the static field trial groups. |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 16 | // *** MUST NOT BE CALLED MORE THAN ONCE. *** |
[email protected] | dc1f854 | 2013-01-30 05:10:29 | [diff] [blame] | 17 | static void ActivateStaticTrials(); |
| 18 | |
| 19 | // Activates all dynamic field trials. The main difference between |
| 20 | // the autocomplete dynamic and static field trials is that the former |
| 21 | // don't require any code changes on the Chrome side as they are controlled |
| 22 | // on the server side. Chrome binary simply propagates all necessary |
| 23 | // information through the X-Chrome-Variations header. |
| 24 | // This method, unlike ActivateStaticTrials(), may be called multiple times. |
| 25 | static void ActivateDynamicTrials(); |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 26 | |
[email protected] | 5fc1217c | 2013-02-12 21:25:19 | [diff] [blame] | 27 | // Returns a bitmap containing AutocompleteProvider::Type values |
| 28 | // that should be disabled in AutocompleteController. |
| 29 | // This method simply goes over all autocomplete dynamic field trial groups |
| 30 | // and looks for group names like "ProvidersDisabled_NNN" where NNN is |
| 31 | // an integer corresponding to a bitmap mask. All extracted bitmaps |
| 32 | // are OR-ed together and returned as the final result. |
| 33 | static int GetDisabledProviderTypes(); |
| 34 | |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 35 | // --------------------------------------------------------- |
[email protected] | 032d5e6c | 2012-02-17 17:53:55 | [diff] [blame] | 36 | // For the inline History Quick Provider field trial. |
| 37 | |
| 38 | // Returns whether the user is in any field trial group for this |
| 39 | // field trial. False indicates that the field trial wasn't |
| 40 | // successfully created for some reason. |
| 41 | static bool InDisallowInlineHQPFieldTrial(); |
| 42 | |
| 43 | // Returns whether the user should get the experiment setup or |
| 44 | // the default setup for this field trial. The experiment |
| 45 | // group prohibits inlining suggestions. |
| 46 | static bool InDisallowInlineHQPFieldTrialExperimentGroup(); |
| 47 | |
[email protected] | f5b95ba9 | 2012-03-27 14:05:19 | [diff] [blame] | 48 | // --------------------------------------------------------- |
[email protected] | 618d6e6 | 2012-12-16 05:55:57 | [diff] [blame] | 49 | // For the suggest field trial. |
| 50 | |
| 51 | // Fills in |field_trial_hash| with a hash of the active suggest field trial |
| 52 | // name, if any. Returns true if the suggest field trial was active and |
| 53 | // |field_trial_hash| was initialized. |
| 54 | static bool GetActiveSuggestFieldTrialHash(uint32* field_trial_hash); |
| 55 | |
| 56 | // --------------------------------------------------------- |
[email protected] | 8ad29cc3 | 2012-06-15 19:44:31 | [diff] [blame] | 57 | // For the History Quick Provider new scoring field trial. |
| 58 | |
| 59 | // Returns whether the user is in any field trial group for this |
| 60 | // field trial. False indicates that the field trial wasn't |
| 61 | // successfully created for some reason. |
| 62 | static bool InHQPNewScoringFieldTrial(); |
| 63 | |
| 64 | // Returns whether the user should get the experimental setup or |
| 65 | // the default setup for this field trial. The experiment |
| 66 | // group uses "new scoring" (a complex multiplicative calculation |
| 67 | // that, among other differences from "old scoring", uses word |
| 68 | // break information). |
| 69 | static bool InHQPNewScoringFieldTrialExperimentGroup(); |
| 70 | |
[email protected] | 44025cf2 | 2012-09-25 22:43:31 | [diff] [blame] | 71 | // --------------------------------------------------------- |
| 72 | // For the HistoryURL provider disable culling redirects field trial. |
| 73 | |
| 74 | // Returns whether the user is in any group for this field trial. |
[email protected] | ed5fec21 | 2012-09-29 14:05:29 | [diff] [blame] | 75 | // (Should always be true unless initialization went wrong.) |
[email protected] | 44025cf2 | 2012-09-25 22:43:31 | [diff] [blame] | 76 | static bool InHUPCullRedirectsFieldTrial(); |
| 77 | |
| 78 | // Returns whether we should disable culling of redirects in |
| 79 | // HistoryURL provider. |
| 80 | static bool InHUPCullRedirectsFieldTrialExperimentGroup(); |
| 81 | |
[email protected] | ed5fec21 | 2012-09-29 14:05:29 | [diff] [blame] | 82 | // --------------------------------------------------------- |
| 83 | // For the HistoryURL provider disable creating a shorter match |
| 84 | // field trial. |
| 85 | |
| 86 | // Returns whether the user is in any group for this field trial. |
| 87 | // (Should always be true unless initialization went wrong.) |
| 88 | static bool InHUPCreateShorterMatchFieldTrial(); |
| 89 | |
| 90 | // Returns whether we should disable creating a shorter match in |
| 91 | // HistoryURL provider. |
| 92 | static bool InHUPCreateShorterMatchFieldTrialExperimentGroup(); |
| 93 | |
[email protected] | b88fb76 | 2012-11-10 19:10:44 | [diff] [blame] | 94 | // --------------------------------------------------------- |
| 95 | // For the HistoryQuick provider replace HistoryURL provider field trial. |
| 96 | |
| 97 | // Returns whether the user is in any field trial group for this |
| 98 | // field trial. False indicates that the field trial wasn't |
| 99 | // successfully created for some reason. |
| 100 | static bool InHQPReplaceHUPScoringFieldTrial(); |
| 101 | |
| 102 | // Returns whether the user should get the experimental setup or the |
| 103 | // default setup for this field trial. The experiment group |
| 104 | // simultaneously disables HistoryURL provider from searching the |
| 105 | // URL database and directs HistoryQuick provider to calculate both |
| 106 | // HUP-style and HQP-style scores for matches, then return whichever |
| 107 | // is larger. |
| 108 | static bool InHQPReplaceHUPScoringFieldTrialExperimentGroup(); |
| 109 | |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 110 | private: |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame^] | 111 | DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
[email protected] | 146759d | 2012-01-31 01:25:47 | [diff] [blame] | 112 | }; |
| 113 | |
[email protected] | 684fcc1 | 2013-03-08 22:50:02 | [diff] [blame^] | 114 | #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |