OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 6 #define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // query suggestions less aggressively so that they don't inline. | 111 // query suggestions less aggressively so that they don't inline. |
112 static bool SearchHistoryPreventInlining( | 112 static bool SearchHistoryPreventInlining( |
113 AutocompleteInput::PageClassification current_page_classification); | 113 AutocompleteInput::PageClassification current_page_classification); |
114 | 114 |
115 // Returns true if the user is in the experiment group that, given the | 115 // Returns true if the user is in the experiment group that, given the |
116 // provided |current_page_classification| context, disables all query | 116 // provided |current_page_classification| context, disables all query |
117 // suggestions from search history. | 117 // suggestions from search history. |
118 static bool SearchHistoryDisable( | 118 static bool SearchHistoryDisable( |
119 AutocompleteInput::PageClassification current_page_classification); | 119 AutocompleteInput::PageClassification current_page_classification); |
120 | 120 |
| 121 // --------------------------------------------------------- |
| 122 // For the ReorderForLegalDefaultMatch experiment that's part of the |
| 123 // bundled omnibox field trial. |
| 124 |
| 125 // Returns true if the omnibox will reorder matches, in the provided |
| 126 // |current_page_classification| context so that a match that's allowed to |
| 127 // be the default match will appear first. This means AutocompleteProviders |
| 128 // can score matches however they desire without regard to making sure the |
| 129 // top match when all the matches from all providers are merged is a legal |
| 130 // default match. |
| 131 static bool ReorderForLegalDefaultMatch( |
| 132 AutocompleteInput::PageClassification current_page_classification); |
| 133 |
121 private: | 134 private: |
122 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest, GetValueForRuleInContext); | 135 FRIEND_TEST_ALL_PREFIXES(OmniboxFieldTrialTest, GetValueForRuleInContext); |
123 | 136 |
124 // The bundled omnibox experiment comes with a set of parameters | 137 // The bundled omnibox experiment comes with a set of parameters |
125 // (key-value pairs). Each key indicates a certain rule that applies in | 138 // (key-value pairs). Each key indicates a certain rule that applies in |
126 // a certain context. The value indicates what the consequences of | 139 // a certain context. The value indicates what the consequences of |
127 // applying the rule are. For example, the value of a SearchHistory rule | 140 // applying the rule are. For example, the value of a SearchHistory rule |
128 // in the context of a search results page might indicate that we should | 141 // in the context of a search results page might indicate that we should |
129 // prevent search history matches from inlining. | 142 // prevent search history matches from inlining. |
130 // | 143 // |
131 // This function returns the value associated with the |rule| that applies | 144 // This function returns the value associated with the |rule| that applies |
132 // in the current context (which currently only consists of | 145 // in the current context (which currently only consists of |
133 // |page_classification| but will soon contain other features, some not | 146 // |page_classification| but will soon contain other features, some not |
134 // passed in as parameters, such as whether Instant Extended is enabled). | 147 // passed in as parameters, such as whether Instant Extended is enabled). |
135 // If no such rule exists in the current context, looks for that rule in | 148 // If no such rule exists in the current context, looks for that rule in |
136 // the global context and return its value if found. If the rule remains | 149 // the global context and return its value if found. If the rule remains |
137 // unfound in the global context, returns the empty string. For more | 150 // unfound in the global context, returns the empty string. For more |
138 // details, see the implementation. How to interpret the value is left | 151 // details, see the implementation. How to interpret the value is left |
139 // to the caller; this is rule-dependent. | 152 // to the caller; this is rule-dependent. |
140 static std::string GetValueForRuleInContext( | 153 static std::string GetValueForRuleInContext( |
141 const std::string& rule, | 154 const std::string& rule, |
142 AutocompleteInput::PageClassification page_classification); | 155 AutocompleteInput::PageClassification page_classification); |
143 | 156 |
144 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 157 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
145 }; | 158 }; |
146 | 159 |
147 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 160 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |