blob: 0371c3b1d9a541a9b34d65f650845c2fb17fe293 [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>
9
10#include "base/basictypes.h"
11
[email protected]684fcc12013-03-08 22:50:0212// This class manages the Omnibox field trials.
13class OmniboxFieldTrial {
[email protected]146759d2012-01-31 01:25:4714 public:
[email protected]dc1f8542013-01-30 05:10:2915 // Creates the static field trial groups.
[email protected]146759d2012-01-31 01:25:4716 // *** MUST NOT BE CALLED MORE THAN ONCE. ***
[email protected]dc1f8542013-01-30 05:10:2917 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]146759d2012-01-31 01:25:4726
[email protected]5fc1217c2013-02-12 21:25:1927 // 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]146759d2012-01-31 01:25:4735 // ---------------------------------------------------------
[email protected]032d5e6c2012-02-17 17:53:5536 // 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]f5b95ba92012-03-27 14:05:1948 // ---------------------------------------------------------
[email protected]618d6e62012-12-16 05:55:5749 // 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]8ad29cc32012-06-15 19:44:3157 // 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]44025cf22012-09-25 22:43:3171 // ---------------------------------------------------------
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]ed5fec212012-09-29 14:05:2975 // (Should always be true unless initialization went wrong.)
[email protected]44025cf22012-09-25 22:43:3176 static bool InHUPCullRedirectsFieldTrial();
77
78 // Returns whether we should disable culling of redirects in
79 // HistoryURL provider.
80 static bool InHUPCullRedirectsFieldTrialExperimentGroup();
81
[email protected]ed5fec212012-09-29 14:05:2982 // ---------------------------------------------------------
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]b88fb762012-11-10 19:10:4494 // ---------------------------------------------------------
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]146759d2012-01-31 01:25:47110 private:
[email protected]684fcc12013-03-08 22:50:02111 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
[email protected]146759d2012-01-31 01:25:47112};
113
[email protected]684fcc12013-03-08 22:50:02114#endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_