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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "chrome/browser/autocomplete/autocomplete_input.h" | |
15 #include "chrome/common/autocomplete_match_type.h" | 14 #include "chrome/common/autocomplete_match_type.h" |
| 15 #include "components/metrics/proto/omnibox_event.pb.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class TimeDelta; | 18 class TimeDelta; |
19 } | 19 } |
20 | 20 |
21 // The set of parameters customizing the HUP scoring. | 21 // The set of parameters customizing the HUP scoring. |
22 struct HUPScoringParams { | 22 struct HUPScoringParams { |
23 // A set of parameters describing how to cap a given count score. First, | 23 // A set of parameters describing how to cap a given count score. First, |
24 // we apply a half-life based decay of the given count and then find the | 24 // we apply a half-life based decay of the given count and then find the |
25 // maximum relevance score in the corresponding bucket list. | 25 // maximum relevance score in the corresponding bucket list. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // |current_page_classification| context, changes the maximum relevance | 183 // |current_page_classification| context, changes the maximum relevance |
184 // ShortcutsProvider::CalculateScore() is supposed to assign, extract | 184 // ShortcutsProvider::CalculateScore() is supposed to assign, extract |
185 // that maximum relevance score and put in in |max_relevance|. Returns | 185 // that maximum relevance score and put in in |max_relevance|. Returns |
186 // true on a successful extraction. CalculateScore()'s return value is | 186 // true on a successful extraction. CalculateScore()'s return value is |
187 // a product of this maximum relevance score and some attenuating factors | 187 // a product of this maximum relevance score and some attenuating factors |
188 // that are all between 0 and 1. (Note that Shortcuts results may have | 188 // that are all between 0 and 1. (Note that Shortcuts results may have |
189 // their scores reduced later if the assigned score is higher than allowed | 189 // their scores reduced later if the assigned score is higher than allowed |
190 // for non-inlineable results. Shortcuts results are not allowed to be | 190 // for non-inlineable results. Shortcuts results are not allowed to be |
191 // inlined.) | 191 // inlined.) |
192 static bool ShortcutsScoringMaxRelevance( | 192 static bool ShortcutsScoringMaxRelevance( |
193 AutocompleteInput::PageClassification current_page_classification, | 193 metrics::OmniboxEventProto::PageClassification |
| 194 current_page_classification, |
194 int* max_relevance); | 195 int* max_relevance); |
195 | 196 |
196 // --------------------------------------------------------- | 197 // --------------------------------------------------------- |
197 // For the SearchHistory experiment that's part of the bundled omnibox | 198 // For the SearchHistory experiment that's part of the bundled omnibox |
198 // field trial. | 199 // field trial. |
199 | 200 |
200 // Returns true if the user is in the experiment group that, given the | 201 // Returns true if the user is in the experiment group that, given the |
201 // provided |current_page_classification| context, scores search history | 202 // provided |current_page_classification| context, scores search history |
202 // query suggestions less aggressively so that they don't inline. | 203 // query suggestions less aggressively so that they don't inline. |
203 static bool SearchHistoryPreventInlining( | 204 static bool SearchHistoryPreventInlining( |
204 AutocompleteInput::PageClassification current_page_classification); | 205 metrics::OmniboxEventProto::PageClassification |
| 206 current_page_classification); |
205 | 207 |
206 // Returns true if the user is in the experiment group that, given the | 208 // Returns true if the user is in the experiment group that, given the |
207 // provided |current_page_classification| context, disables all query | 209 // provided |current_page_classification| context, disables all query |
208 // suggestions from search history. | 210 // suggestions from search history. |
209 static bool SearchHistoryDisable( | 211 static bool SearchHistoryDisable( |
210 AutocompleteInput::PageClassification current_page_classification); | 212 metrics::OmniboxEventProto::PageClassification |
| 213 current_page_classification); |
211 | 214 |
212 // --------------------------------------------------------- | 215 // --------------------------------------------------------- |
213 // For the DemoteByType experiment that's part of the bundled omnibox field | 216 // For the DemoteByType experiment that's part of the bundled omnibox field |
214 // trial. | 217 // trial. |
215 | 218 |
216 // If the user is in an experiment group that, in the provided | 219 // If the user is in an experiment group that, in the provided |
217 // |current_page_classification| context, demotes the relevance scores | 220 // |current_page_classification| context, demotes the relevance scores |
218 // of certain types of matches, populates the |demotions_by_type| map | 221 // of certain types of matches, populates the |demotions_by_type| map |
219 // appropriately. Otherwise, sets |demotions_by_type| to its default | 222 // appropriately. Otherwise, sets |demotions_by_type| to its default |
220 // value based on the context. | 223 // value based on the context. |
221 static void GetDemotionsByType( | 224 static void GetDemotionsByType( |
222 AutocompleteInput::PageClassification current_page_classification, | 225 metrics::OmniboxEventProto::PageClassification |
| 226 current_page_classification, |
223 DemotionMultipliers* demotions_by_type); | 227 DemotionMultipliers* demotions_by_type); |
224 | 228 |
225 // --------------------------------------------------------- | 229 // --------------------------------------------------------- |
226 // For the HistoryURL provider new scoring experiment that is part of the | 230 // For the HistoryURL provider new scoring experiment that is part of the |
227 // bundled omnibox field trial. | 231 // bundled omnibox field trial. |
228 | 232 |
229 // Initializes the HUP |scoring_params| based on the active HUP scoring | 233 // Initializes the HUP |scoring_params| based on the active HUP scoring |
230 // experiment. If there is no such experiment, this function simply sets | 234 // experiment. If there is no such experiment, this function simply sets |
231 // |scoring_params|->experimental_scoring_enabled to false. | 235 // |scoring_params|->experimental_scoring_enabled to false. |
232 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); | 236 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // This function returns the value associated with the |rule| that applies | 323 // This function returns the value associated with the |rule| that applies |
320 // in the current context (which currently consists of |page_classification| | 324 // in the current context (which currently consists of |page_classification| |
321 // and whether Instant Extended is enabled). If no such rule exists in the | 325 // and whether Instant Extended is enabled). If no such rule exists in the |
322 // current context, fall back to the rule in various wildcard contexts and | 326 // current context, fall back to the rule in various wildcard contexts and |
323 // return its value if found. If the rule remains unfound in the global | 327 // return its value if found. If the rule remains unfound in the global |
324 // context, returns the empty string. For more details, including how we | 328 // context, returns the empty string. For more details, including how we |
325 // prioritize different wildcard contexts, see the implementation. How to | 329 // prioritize different wildcard contexts, see the implementation. How to |
326 // interpret the value is left to the caller; this is rule-dependent. | 330 // interpret the value is left to the caller; this is rule-dependent. |
327 static std::string GetValueForRuleInContext( | 331 static std::string GetValueForRuleInContext( |
328 const std::string& rule, | 332 const std::string& rule, |
329 AutocompleteInput::PageClassification page_classification); | 333 metrics::OmniboxEventProto::PageClassification page_classification); |
330 | 334 |
331 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 335 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
332 }; | 336 }; |
333 | 337 |
334 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ | 338 #endif // CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |