| 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 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 // This class manages the Omnibox field trials. | 98 // This class manages the Omnibox field trials. |
| 99 class OmniboxFieldTrial { | 99 class OmniboxFieldTrial { |
| 100 public: | 100 public: |
| 101 // A mapping that contains multipliers indicating that matches of the | 101 // A mapping that contains multipliers indicating that matches of the |
| 102 // specified type should have their relevance score multiplied by the | 102 // specified type should have their relevance score multiplied by the |
| 103 // given number. Omitted types are assumed to have multipliers of 1.0. | 103 // given number. Omitted types are assumed to have multipliers of 1.0. |
| 104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; | 104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; |
| 105 | 105 |
| 106 // A vector that maps from the number of matching pages to the document |
| 107 // specificity score used in HistoryQuick provider / ScoredHistoryMatch |
| 108 // scoring. The vector is sorted by the size_t (the number of matching pages). |
| 109 // If an entry is omitted, the appropriate value is assumed to be the one in |
| 110 // the later bucket. For example, with a vector containing {{1, 2.0}, |
| 111 // {3, 1.5}}, the score for 2 is inferred to be 1.5. Values beyond the |
| 112 // end of the vector are assumed to have scores of 1.0. |
| 113 typedef std::vector<std::pair<size_t, double>> NumMatchesScores; |
| 114 |
| 106 // Do not change these values as they need to be in sync with values | 115 // Do not change these values as they need to be in sync with values |
| 107 // specified in experiment configs on the variations server. | 116 // specified in experiment configs on the variations server. |
| 108 enum EmphasizeTitlesCondition { | 117 enum EmphasizeTitlesCondition { |
| 109 EMPHASIZE_WHEN_NONEMPTY = 0, | 118 EMPHASIZE_WHEN_NONEMPTY = 0, |
| 110 EMPHASIZE_WHEN_TITLE_MATCHES = 1, | 119 EMPHASIZE_WHEN_TITLE_MATCHES = 1, |
| 111 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, | 120 EMPHASIZE_WHEN_ONLY_TITLE_MATCHES = 2, |
| 112 EMPHASIZE_NEVER = 3 | 121 EMPHASIZE_NEVER = 3 |
| 113 }; | 122 }; |
| 114 | 123 |
| 115 // --------------------------------------------------------- | 124 // --------------------------------------------------------- |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 static bool HQPFreqencyUsesSum(); | 311 static bool HQPFreqencyUsesSum(); |
| 303 | 312 |
| 304 // Returns the number of visits HQP should use when computing frequency | 313 // Returns the number of visits HQP should use when computing frequency |
| 305 // scores. Returns 10 if the epxeriment isn't active. | 314 // scores. Returns 10 if the epxeriment isn't active. |
| 306 static size_t HQPMaxVisitsToScore(); | 315 static size_t HQPMaxVisitsToScore(); |
| 307 | 316 |
| 308 // Returns the score that should be given to typed transitions. (The score | 317 // 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. | 318 // of non-typed transitions is 1.) Returns 20 if the experiment isn't active. |
| 310 static float HQPTypedValue(); | 319 static float HQPTypedValue(); |
| 311 | 320 |
| 321 // Returns NumMatchesScores; see comment by the declaration of it. |
| 322 // Returns an empty NumMatchesScores if the experiment isn't active. |
| 323 static NumMatchesScores HQPNumMatchesScores(); |
| 324 |
| 312 // --------------------------------------------------------- | 325 // --------------------------------------------------------- |
| 313 // For the HQPNumTitleWords experiment that's part of the | 326 // For the HQPNumTitleWords experiment that's part of the |
| 314 // bundled omnibox field trial. | 327 // bundled omnibox field trial. |
| 315 | 328 |
| 316 // Returns the number of title words that are allowed to contribute | 329 // Returns the number of title words that are allowed to contribute |
| 317 // to the topicality score. Words later in the title are ignored. | 330 // to the topicality score. Words later in the title are ignored. |
| 318 // Returns 20 as a default if the experiment isn't active. | 331 // Returns 20 as a default if the experiment isn't active. |
| 319 static size_t HQPNumTitleWordsToAllow(); | 332 static size_t HQPNumTitleWordsToAllow(); |
| 320 | 333 |
| 321 // --------------------------------------------------------- | 334 // --------------------------------------------------------- |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 static const char kHQPAllowMatchInSchemeRule[]; | 395 static const char kHQPAllowMatchInSchemeRule[]; |
| 383 static const char kZeroSuggestRule[]; | 396 static const char kZeroSuggestRule[]; |
| 384 static const char kZeroSuggestVariantRule[]; | 397 static const char kZeroSuggestVariantRule[]; |
| 385 static const char kSuggestVariantRule[]; | 398 static const char kSuggestVariantRule[]; |
| 386 static const char kDisableResultsCachingRule[]; | 399 static const char kDisableResultsCachingRule[]; |
| 387 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; | 400 static const char kMeasureSuggestPollingDelayFromLastKeystrokeRule[]; |
| 388 static const char kSuggestPollingDelayMsRule[]; | 401 static const char kSuggestPollingDelayMsRule[]; |
| 389 static const char kHQPFixFewVisitsBugRule[]; | 402 static const char kHQPFixFewVisitsBugRule[]; |
| 390 static const char kHQPFreqencyUsesSumRule[]; | 403 static const char kHQPFreqencyUsesSumRule[]; |
| 391 static const char kHQPMaxVisitsToScoreRule[]; | 404 static const char kHQPMaxVisitsToScoreRule[]; |
| 405 static const char kHQPNumMatchesScoresRule[]; |
| 392 static const char kHQPNumTitleWordsRule[]; | 406 static const char kHQPNumTitleWordsRule[]; |
| 393 static const char kHQPAlsoDoHUPLikeScoringRule[]; | 407 static const char kHQPAlsoDoHUPLikeScoringRule[]; |
| 394 static const char kHUPSearchDatabaseRule[]; | 408 static const char kHUPSearchDatabaseRule[]; |
| 395 static const char kPreventUWYTDefaultForNonURLInputsRule[]; | 409 static const char kPreventUWYTDefaultForNonURLInputsRule[]; |
| 396 static const char kKeywordRequiresRegistryRule[]; | 410 static const char kKeywordRequiresRegistryRule[]; |
| 397 static const char kKeywordRequiresPrefixMatchRule[]; | 411 static const char kKeywordRequiresPrefixMatchRule[]; |
| 398 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; | 412 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; |
| 399 static const char kHQPAllowDupMatchesForScoringRule[]; | 413 static const char kHQPAllowDupMatchesForScoringRule[]; |
| 400 static const char kEmphasizeTitlesRule[]; | 414 static const char kEmphasizeTitlesRule[]; |
| 401 | 415 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 // prioritize different wildcard contexts, see the implementation. How to | 453 // prioritize different wildcard contexts, see the implementation. How to |
| 440 // interpret the value is left to the caller; this is rule-dependent. | 454 // interpret the value is left to the caller; this is rule-dependent. |
| 441 static std::string GetValueForRuleInContext( | 455 static std::string GetValueForRuleInContext( |
| 442 const std::string& rule, | 456 const std::string& rule, |
| 443 metrics::OmniboxEventProto::PageClassification page_classification); | 457 metrics::OmniboxEventProto::PageClassification page_classification); |
| 444 | 458 |
| 445 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 459 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
| 446 }; | 460 }; |
| 447 | 461 |
| 448 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 462 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
| OLD | NEW |