blob: 6fe5149d774b8d5dca2d97b612deab6ff9b01c23 [file] [log] [blame]
[email protected]146759d2012-01-31 01:25:471// 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]684fcc12013-03-08 22:50:025#ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
6#define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
[email protected]146759d2012-01-31 01:25:477
8#include <string>
[email protected]fea6d302013-04-13 02:04:069#include <vector>
[email protected]146759d2012-01-31 01:25:4710
11#include "base/basictypes.h"
12
[email protected]684fcc12013-03-08 22:50:0213// This class manages the Omnibox field trials.
14class OmniboxFieldTrial {
[email protected]146759d2012-01-31 01:25:4715 public:
[email protected]dc1f8542013-01-30 05:10:2916 // Creates the static field trial groups.
[email protected]146759d2012-01-31 01:25:4717 // *** MUST NOT BE CALLED MORE THAN ONCE. ***
[email protected]dc1f8542013-01-30 05:10:2918 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]146759d2012-01-31 01:25:4727
[email protected]5fc1217c2013-02-12 21:25:1928 // 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]146759d2012-01-31 01:25:4736 // ---------------------------------------------------------
[email protected]032d5e6c2012-02-17 17:53:5537 // 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]f5b95ba92012-03-27 14:05:1949 // ---------------------------------------------------------
[email protected]618d6e62012-12-16 05:55:5750 // For the suggest field trial.
51
[email protected]fea6d302013-04-13 02:04:0652 // 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]618d6e62012-12-16 05:55:5756
57 // ---------------------------------------------------------
[email protected]9bfc2c82013-05-03 22:15:2158 // For the HistoryQuick provider field trial that combines replacing
59 // the HistoryURL provider and turning on "new scoring" in HistoryQuick
60 // provider.
[email protected]8ad29cc32012-06-15 19:44:3161
[email protected]9bfc2c82013-05-03 22:15:2162 // 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]8ad29cc32012-06-15 19:44:3167
[email protected]9bfc2c82013-05-03 22:15:2168 // 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]8ad29cc32012-06-15 19:44:3174
[email protected]44025cf22012-09-25 22:43:3175 // ---------------------------------------------------------
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]ed5fec212012-09-29 14:05:2979 // (Should always be true unless initialization went wrong.)
[email protected]44025cf22012-09-25 22:43:3180 static bool InHUPCullRedirectsFieldTrial();
81
82 // Returns whether we should disable culling of redirects in
83 // HistoryURL provider.
84 static bool InHUPCullRedirectsFieldTrialExperimentGroup();
85
[email protected]ed5fec212012-09-29 14:05:2986 // ---------------------------------------------------------
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]b88fb762012-11-10 19:10:4498 // ---------------------------------------------------------
[email protected]42f4251b2013-04-23 07:46:3999 // 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]d16ad452013-05-02 22:13:18110 // ---------------------------------------------------------
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]146759d2012-01-31 01:25:47118 private:
[email protected]684fcc12013-03-08 22:50:02119 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
[email protected]146759d2012-01-31 01:25:47120};
121
[email protected]684fcc12013-03-08 22:50:02122#endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_