Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/containers/hash_tables.h" | |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "components/metrics/proto/omnibox_event.pb.h" | 17 #include "components/metrics/proto/omnibox_event.pb.h" |
| 17 #include "components/metrics/proto/omnibox_input_type.pb.h" | 18 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 18 #include "components/omnibox/browser/autocomplete_match_type.h" | 19 #include "components/omnibox/browser/autocomplete_match_type.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class TimeDelta; | 22 class TimeDelta; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // The set of parameters customizing the HUP scoring. | 25 // The set of parameters customizing the HUP scoring. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 // This class manages the Omnibox field trials. | 99 // This class manages the Omnibox field trials. |
| 99 class OmniboxFieldTrial { | 100 class OmniboxFieldTrial { |
| 100 public: | 101 public: |
| 101 // A mapping that contains multipliers indicating that matches of the | 102 // A mapping that contains multipliers indicating that matches of the |
| 102 // specified type should have their relevance score multiplied by the | 103 // specified type should have their relevance score multiplied by the |
| 103 // given number. Omitted types are assumed to have multipliers of 1.0. | 104 // given number. Omitted types are assumed to have multipliers of 1.0. |
| 104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; | 105 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; |
| 105 | 106 |
| 107 // A mapping from the number of matching pages to the multiplier by which | |
| 108 // all those matching pages' frequency scores should be multiplied. | |
| 109 // Omitted values are assumed to have multipliers of 1.0. | |
| 110 typedef base::hash_map<size_t, double> NumMatchesMultipliers; | |
|
Peter Kasting
2016/12/01 07:07:53
I don't know that I love the data structure choice
Mark P
2016/12/04 01:06:42
Sure. I debated data structures with myself. Hap
| |
| 111 | |
| 106 // Do not change these values as they need to be in sync with values | 112 // Do not change these values as they need to be in sync with values |
| 107 // specified in experiment configs on the variations server. | 113 // specified in experiment configs on the variations server. |
| 108 enum EmphasizeTitlesCondition { | 114 enum EmphasizeTitlesCondition { |
| 109 EMPHASIZE_WHEN_NONEMPTY = 0, | 115 EMPHASIZE_WHEN_NONEMPTY = 0, |
| 110 EMPHASIZE_WHEN_TITLE_MATCHES = 1, | 116 EMPHASIZE_WHEN_TITLE_MATCHES = 1, |
| 111 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, | 117 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, |
| 112 EMPHASIZE_NEVER = 3 | 118 EMPHASIZE_NEVER = 3 |
| 113 }; | 119 }; |
| 114 | 120 |
| 115 // --------------------------------------------------------- | 121 // --------------------------------------------------------- |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 static bool HQPFreqencyUsesSum(); | 308 static bool HQPFreqencyUsesSum(); |
| 303 | 309 |
| 304 // Returns the number of visits HQP should use when computing frequency | 310 // Returns the number of visits HQP should use when computing frequency |
| 305 // scores. Returns 10 if the epxeriment isn't active. | 311 // scores. Returns 10 if the epxeriment isn't active. |
| 306 static size_t HQPMaxVisitsToScore(); | 312 static size_t HQPMaxVisitsToScore(); |
| 307 | 313 |
| 308 // Returns the score that should be given to typed transitions. (The score | 314 // Returns the score that should be given to typed transitions. (The score |
| 309 // of non-typed transitions is 1.) Returns 20 if the experiment isn't active. | 315 // of non-typed transitions is 1.) Returns 20 if the experiment isn't active. |
| 310 static float HQPTypedValue(); | 316 static float HQPTypedValue(); |
| 311 | 317 |
| 318 // Populates |num_matches_multipliers|. See comment by the declaration of | |
| 319 // NumMatchesMultipliers. Left empty if not set. | |
| 320 static void HQPGetNumMatchesMultipliers( | |
| 321 NumMatchesMultipliers* num_matches_multipliers); | |
|
Peter Kasting
2016/12/01 07:07:53
Nit: You could probably return the multipliers by
Mark P
2016/12/04 01:06:42
Okay. I guess it's small enough to copy off the s
| |
| 322 | |
| 312 // --------------------------------------------------------- | 323 // --------------------------------------------------------- |
| 313 // For the HQPNumTitleWords experiment that's part of the | 324 // For the HQPNumTitleWords experiment that's part of the |
| 314 // bundled omnibox field trial. | 325 // bundled omnibox field trial. |
| 315 | 326 |
| 316 // Returns the number of title words that are allowed to contribute | 327 // Returns the number of title words that are allowed to contribute |
| 317 // to the topicality score. Words later in the title are ignored. | 328 // to the topicality score. Words later in the title are ignored. |
| 318 // Returns 20 as a default if the experiment isn't active. | 329 // Returns 20 as a default if the experiment isn't active. |
| 319 static size_t HQPNumTitleWordsToAllow(); | 330 static size_t HQPNumTitleWordsToAllow(); |
| 320 | 331 |
| 321 // --------------------------------------------------------- | 332 // --------------------------------------------------------- |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 static const char kHQPAllowMatchInSchemeRule[]; | 393 static const char kHQPAllowMatchInSchemeRule[]; |
| 383 static const char kZeroSuggestRule[]; | 394 static const char kZeroSuggestRule[]; |
| 384 static const char kZeroSuggestVariantRule[]; | 395 static const char kZeroSuggestVariantRule[]; |
| 385 static const char kSuggestVariantRule[]; | 396 static const char kSuggestVariantRule[]; |
| 386 static const char kDisableResultsCachingRule[]; | 397 static const char kDisableResultsCachingRule[]; |
| 387 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; | 398 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; |
| 388 static const char kSuggestPollingDelayMsRule[]; | 399 static const char kSuggestPollingDelayMsRule[]; |
| 389 static const char kHQPFixFewVisitsBugRule[]; | 400 static const char kHQPFixFewVisitsBugRule[]; |
| 390 static const char kHQPFreqencyUsesSumRule[]; | 401 static const char kHQPFreqencyUsesSumRule[]; |
| 391 static const char kHQPMaxVisitsToScoreRule[]; | 402 static const char kHQPMaxVisitsToScoreRule[]; |
| 403 static const char kHQPNumMatchesMultipliersRule[]; | |
| 392 static const char kHQPNumTitleWordsRule[]; | 404 static const char kHQPNumTitleWordsRule[]; |
| 393 static const char kHQPAlsoDoHUPLikeScoringRule[]; | 405 static const char kHQPAlsoDoHUPLikeScoringRule[]; |
| 394 static const char kHUPSearchDatabaseRule[]; | 406 static const char kHUPSearchDatabaseRule[]; |
| 395 static const char kPreventUWYTDefaultForNonURLInputsRule[]; | 407 static const char kPreventUWYTDefaultForNonURLInputsRule[]; |
| 396 static const char kKeywordRequiresRegistryRule[]; | 408 static const char kKeywordRequiresRegistryRule[]; |
| 397 static const char kKeywordRequiresPrefixMatchRule[]; | 409 static const char kKeywordRequiresPrefixMatchRule[]; |
| 398 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; | 410 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; |
| 399 static const char kHQPAllowDupMatchesForScoringRule[]; | 411 static const char kHQPAllowDupMatchesForScoringRule[]; |
| 400 static const char kEmphasizeTitlesRule[]; | 412 static const char kEmphasizeTitlesRule[]; |
| 401 | 413 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 // prioritize different wildcard contexts, see the implementation. How to | 451 // prioritize different wildcard contexts, see the implementation. How to |
| 440 // interpret the value is left to the caller; this is rule-dependent. | 452 // interpret the value is left to the caller; this is rule-dependent. |
| 441 static std::string GetValueForRuleInContext( | 453 static std::string GetValueForRuleInContext( |
| 442 const std::string& rule, | 454 const std::string& rule, |
| 443 metrics::OmniboxEventProto::PageClassification page_classification); | 455 metrics::OmniboxEventProto::PageClassification page_classification); |
| 444 | 456 |
| 445 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 457 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 446 }; | 458 }; |
| 447 | 459 |
| 448 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 460 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |