Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: components/omnibox/browser/omnibox_field_trial.h

Issue 2591053002: Show PhysicalWebProvider suggestions with omnibox input (Closed)
Patch Set: add field trials Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 HUPScoringParams() : experimental_scoring_enabled(false) {} 88 HUPScoringParams() : experimental_scoring_enabled(false) {}
89 89
90 bool experimental_scoring_enabled; 90 bool experimental_scoring_enabled;
91 91
92 ScoreBuckets typed_count_buckets; 92 ScoreBuckets typed_count_buckets;
93 93
94 // Used only when the typed count is 0. 94 // Used only when the typed count is 0.
95 ScoreBuckets visited_count_buckets; 95 ScoreBuckets visited_count_buckets;
96 }; 96 };
97 97
98 // The set of parameters customizing PhysicalWebProvider relevance scoring.
Mark P 2016/12/21 23:21:41 This approach works but I feel it's a little heavy
mattreynolds 2016/12/22 00:23:40 Agreed, this is cleaner and less error-prone. Done
99 struct PhysicalWebScoringParams {
100 PhysicalWebScoringParams() : experimental_scoring_enabled(false) {}
101
102 bool experimental_scoring_enabled;
103
104 // The base relevance score for PhysicalWebProvider suggestions when the user
105 // has not entered any text in the omnibox.
106 int zero_suggest_base_relevance;
107
108 // The base relevance score for PhysicalWebprovider suggestions after the user
109 // has typed a query in the omnibox.
110 int after_typing_base_relevance;
111 };
112
98 // This class manages the Omnibox field trials. 113 // This class manages the Omnibox field trials.
99 class OmniboxFieldTrial { 114 class OmniboxFieldTrial {
100 public: 115 public:
101 // A mapping that contains multipliers indicating that matches of the 116 // A mapping that contains multipliers indicating that matches of the
102 // specified type should have their relevance score multiplied by the 117 // specified type should have their relevance score multiplied by the
103 // given number. Omitted types are assumed to have multipliers of 1.0. 118 // given number. Omitted types are assumed to have multipliers of 1.0.
104 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers; 119 typedef std::map<AutocompleteMatchType::Type, float> DemotionMultipliers;
105 120
106 // A vector that maps from the number of matching pages to the document 121 // A vector that maps from the number of matching pages to the document
107 // specificity score used in HistoryQuick provider / ScoredHistoryMatch 122 // specificity score used in HistoryQuick provider / ScoredHistoryMatch
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // field trial. 382 // field trial.
368 383
369 // Returns the conditions under which the UI code should display the title 384 // Returns the conditions under which the UI code should display the title
370 // of a URL more prominently than the URL for an input of type |input_type|. 385 // of a URL more prominently than the URL for an input of type |input_type|.
371 // Normally the URL is displayed more prominently. Returns NEVER_EMPHASIZE 386 // Normally the URL is displayed more prominently. Returns NEVER_EMPHASIZE
372 // if the experiment isn't active. 387 // if the experiment isn't active.
373 static EmphasizeTitlesCondition GetEmphasizeTitlesConditionForInput( 388 static EmphasizeTitlesCondition GetEmphasizeTitlesConditionForInput(
374 metrics::OmniboxInputType::Type input_type); 389 metrics::OmniboxInputType::Type input_type);
375 390
376 // --------------------------------------------------------- 391 // ---------------------------------------------------------
392 // For PhysicalWebProvider related experiments.
393
394 // Returns whether the user is in a Physical Web field trial where the
395 // PhysicalWebProvider should be used to get suggestions when the user clicks
396 // on the omnibox but has not typed anything yet.
397 static bool InPhysicalWebZeroSuggestFieldTrial();
398
399 // Returns whether the user is in a Physical Web field trial and URL-based
400 // suggestions can continue to appear after the user has started typing.
401 static bool InPhysicalWebAfterTypingFieldTrial();
402
403 // Initializes the PhysicalWebProvider |scoring_params| based on the active
404 // Physical Web scoring experiment. If there is no such experiment, this
405 // function simply sets |scoring_params|->experimental_scoring_enabled to
406 // false.
407 static void GetExperimentalPhysicalWebScoringParams(
408 PhysicalWebScoringParams* scoring_params);
409
410 // ---------------------------------------------------------
377 // Exposed publicly for the sake of unittests. 411 // Exposed publicly for the sake of unittests.
378 static const char kBundledExperimentFieldTrialName[]; 412 static const char kBundledExperimentFieldTrialName[];
379 // Rule names used by the bundled experiment. 413 // Rule names used by the bundled experiment.
380 static const char kDisableProvidersRule[]; 414 static const char kDisableProvidersRule[];
381 static const char kShortcutsScoringMaxRelevanceRule[]; 415 static const char kShortcutsScoringMaxRelevanceRule[];
382 static const char kSearchHistoryRule[]; 416 static const char kSearchHistoryRule[];
383 static const char kDemoteByTypeRule[]; 417 static const char kDemoteByTypeRule[];
384 static const char kHQPBookmarkValueRule[]; 418 static const char kHQPBookmarkValueRule[];
385 static const char kHQPTypedValueRule[]; 419 static const char kHQPTypedValueRule[];
386 static const char kHQPDiscountFrecencyWhenFewVisitsRule[]; 420 static const char kHQPDiscountFrecencyWhenFewVisitsRule[];
(...skipping 11 matching lines...) Expand all
398 static const char kHQPNumMatchesScoresRule[]; 432 static const char kHQPNumMatchesScoresRule[];
399 static const char kHQPNumTitleWordsRule[]; 433 static const char kHQPNumTitleWordsRule[];
400 static const char kHQPAlsoDoHUPLikeScoringRule[]; 434 static const char kHQPAlsoDoHUPLikeScoringRule[];
401 static const char kHUPSearchDatabaseRule[]; 435 static const char kHUPSearchDatabaseRule[];
402 static const char kPreventUWYTDefaultForNonURLInputsRule[]; 436 static const char kPreventUWYTDefaultForNonURLInputsRule[];
403 static const char kKeywordRequiresRegistryRule[]; 437 static const char kKeywordRequiresRegistryRule[];
404 static const char kKeywordRequiresPrefixMatchRule[]; 438 static const char kKeywordRequiresPrefixMatchRule[];
405 static const char kKeywordScoreForSufficientlyCompleteMatchRule[]; 439 static const char kKeywordScoreForSufficientlyCompleteMatchRule[];
406 static const char kHQPAllowDupMatchesForScoringRule[]; 440 static const char kHQPAllowDupMatchesForScoringRule[];
407 static const char kEmphasizeTitlesRule[]; 441 static const char kEmphasizeTitlesRule[];
442 static const char kPhysicalWebZeroSuggestRule[];
443 static const char kPhysicalWebAfterTypingRule[];
408 444
409 // Parameter names used by the HUP new scoring experiments. 445 // Parameter names used by the HUP new scoring experiments.
410 static const char kHUPNewScoringEnabledParam[]; 446 static const char kHUPNewScoringEnabledParam[];
411 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; 447 static const char kHUPNewScoringTypedCountRelevanceCapParam[];
412 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; 448 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[];
413 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; 449 static const char kHUPNewScoringTypedCountScoreBucketsParam[];
414 static const char kHUPNewScoringTypedCountUseDecayFactorParam[]; 450 static const char kHUPNewScoringTypedCountUseDecayFactorParam[];
415 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; 451 static const char kHUPNewScoringVisitedCountRelevanceCapParam[];
416 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; 452 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[];
417 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; 453 static const char kHUPNewScoringVisitedCountScoreBucketsParam[];
418 static const char kHUPNewScoringVisitedCountUseDecayFactorParam[]; 454 static const char kHUPNewScoringVisitedCountUseDecayFactorParam[];
419 455
420 // Parameter names used by the HQP experimental scoring experiments. 456 // Parameter names used by the HQP experimental scoring experiments.
421 static const char kHQPExperimentalScoringBucketsParam[]; 457 static const char kHQPExperimentalScoringBucketsParam[];
422 static const char kHQPExperimentalScoringTopicalityThresholdParam[]; 458 static const char kHQPExperimentalScoringTopicalityThresholdParam[];
423 459
460 // Parameter names used by the Physical Web experimental scoring experiments.
461 static const char kPhysicalWebExperimentalScoringParam[];
462 static const char kPhysicalWebZeroSuggestBaseRelevanceParam[];
463 static const char kPhysicalWebAfterTypingBaseRelevanceParam[];
464
424 // The amount of time to wait before sending a new suggest request after the 465 // The amount of time to wait before sending a new suggest request after the
425 // previous one unless overridden by a field trial parameter. 466 // previous one unless overridden by a field trial parameter.
426 // Non-const because some unittests modify this value. 467 // Non-const because some unittests modify this value.
427 static int kDefaultMinimumTimeBetweenSuggestQueriesMs; 468 static int kDefaultMinimumTimeBetweenSuggestQueriesMs;
428 469
429 private: 470 private:
430 friend class OmniboxFieldTrialTest; 471 friend class OmniboxFieldTrialTest;
431 472
432 // The bundled omnibox experiment comes with a set of parameters 473 // The bundled omnibox experiment comes with a set of parameters
433 // (key-value pairs). Each key indicates a certain rule that applies in 474 // (key-value pairs). Each key indicates a certain rule that applies in
(...skipping 11 matching lines...) Expand all
445 // prioritize different wildcard contexts, see the implementation. How to 486 // prioritize different wildcard contexts, see the implementation. How to
446 // interpret the value is left to the caller; this is rule-dependent. 487 // interpret the value is left to the caller; this is rule-dependent.
447 static std::string GetValueForRuleInContext( 488 static std::string GetValueForRuleInContext(
448 const std::string& rule, 489 const std::string& rule,
449 metrics::OmniboxEventProto::PageClassification page_classification); 490 metrics::OmniboxEventProto::PageClassification page_classification);
450 491
451 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); 492 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
452 }; 493 };
453 494
454 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ 495 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698