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

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

Issue 2591053002: Show PhysicalWebProvider suggestions with omnibox input (Closed)
Patch Set: clear had_physical_web_suggestions_ Created 3 years, 12 months 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 #include "components/omnibox/browser/omnibox_field_trial.h" 5 #include "components/omnibox/browser/omnibox_field_trial.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (value_str.empty()) 524 if (value_str.empty())
525 return EMPHASIZE_NEVER; 525 return EMPHASIZE_NEVER;
526 // This is a best-effort conversion; we trust the hand-crafted parameters 526 // This is a best-effort conversion; we trust the hand-crafted parameters
527 // downloaded from the server to be perfect. There's no need for handle 527 // downloaded from the server to be perfect. There's no need for handle
528 // errors smartly. 528 // errors smartly.
529 int value; 529 int value;
530 base::StringToInt(value_str, &value); 530 base::StringToInt(value_str, &value);
531 return static_cast<EmphasizeTitlesCondition>(value); 531 return static_cast<EmphasizeTitlesCondition>(value);
532 } 532 }
533 533
534 // static
535 bool OmniboxFieldTrial::InPhysicalWebZeroSuggestFieldTrial() {
536 return variations::GetVariationParamValue(
537 kBundledExperimentFieldTrialName,
538 kPhysicalWebZeroSuggestRule) == "true";
539 }
540
541 // static
542 bool OmniboxFieldTrial::InPhysicalWebAfterTypingFieldTrial() {
543 return variations::GetVariationParamValue(
544 kBundledExperimentFieldTrialName,
545 kPhysicalWebAfterTypingRule) == "true";
546 }
547
548 // static
549 int OmniboxFieldTrial::GetPhysicalWebZeroSuggestBaseRelevance() {
550 std::string param_value(variations::GetVariationParamValue(
551 kBundledExperimentFieldTrialName,
552 kPhysicalWebZeroSuggestBaseRelevanceParam));
553 int base_relevance;
554 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance)) {
Mark P 2016/12/22 04:58:16 nit: {} not needed ditto below
mattreynolds 2017/01/04 01:04:03 Done.
555 return base_relevance;
556 }
557 // Default relevance score of the first Physical Web URL autocomplete match
558 // when the user has not typed in the omnibox. This score is intended to be
559 // between ClipboardURLProvider and ZeroSuggestProvider.
560 return 700;
561 }
562
563 // static
564 int OmniboxFieldTrial::GetPhysicalWebAfterTypingBaseRelevance() {
565 std::string param_value(variations::GetVariationParamValue(
566 kBundledExperimentFieldTrialName,
567 kPhysicalWebAfterTypingBaseRelevanceParam));
568 int base_relevance;
569 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance)) {
570 return base_relevance;
571 }
572 // Default relevance score of the first Physical Web URL autocomplete match
573 // when the user typed a query in the omnibox.
Mark P 2016/12/22 04:58:16 nit: typed -> has typed or perhaps is typing also
mattreynolds 2017/01/04 01:04:03 Done.
574 return 700;
575 }
576
534 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = 577 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] =
535 "OmniboxBundledExperimentV1"; 578 "OmniboxBundledExperimentV1";
536 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders"; 579 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders";
537 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = 580 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] =
538 "ShortcutsScoringMaxRelevance"; 581 "ShortcutsScoringMaxRelevance";
539 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; 582 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory";
540 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; 583 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType";
541 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = 584 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] =
542 "HQPBookmarkValue"; 585 "HQPBookmarkValue";
543 const char OmniboxFieldTrial::kHQPTypedValueRule[] = "HQPTypedValue"; 586 const char OmniboxFieldTrial::kHQPTypedValueRule[] = "HQPTypedValue";
(...skipping 21 matching lines...) Expand all
565 "HQPAlsoDoHUPLikeScoring"; 608 "HQPAlsoDoHUPLikeScoring";
566 const char OmniboxFieldTrial::kHUPSearchDatabaseRule[] = 609 const char OmniboxFieldTrial::kHUPSearchDatabaseRule[] =
567 "HUPSearchDatabase"; 610 "HUPSearchDatabase";
568 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] = 611 const char OmniboxFieldTrial::kKeywordRequiresRegistryRule[] =
569 "KeywordRequiresRegistry"; 612 "KeywordRequiresRegistry";
570 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] = 613 const char OmniboxFieldTrial::kKeywordRequiresPrefixMatchRule[] =
571 "KeywordRequiresPrefixMatch"; 614 "KeywordRequiresPrefixMatch";
572 const char OmniboxFieldTrial::kKeywordScoreForSufficientlyCompleteMatchRule[] = 615 const char OmniboxFieldTrial::kKeywordScoreForSufficientlyCompleteMatchRule[] =
573 "KeywordScoreForSufficientlyCompleteMatch"; 616 "KeywordScoreForSufficientlyCompleteMatch";
574 const char OmniboxFieldTrial::kEmphasizeTitlesRule[] = "EmphasizeTitles"; 617 const char OmniboxFieldTrial::kEmphasizeTitlesRule[] = "EmphasizeTitles";
618 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestRule[] =
619 "PhysicalWebZeroSuggest";
620 const char OmniboxFieldTrial::kPhysicalWebAfterTypingRule[] =
621 "PhysicalWebAfterTyping";
575 622
576 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] = 623 const char OmniboxFieldTrial::kHUPNewScoringEnabledParam[] =
577 "HUPExperimentalScoringEnabled"; 624 "HUPExperimentalScoringEnabled";
578 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] = 625 const char OmniboxFieldTrial::kHUPNewScoringTypedCountRelevanceCapParam[] =
579 "TypedCountRelevanceCap"; 626 "TypedCountRelevanceCap";
580 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] = 627 const char OmniboxFieldTrial::kHUPNewScoringTypedCountHalfLifeTimeParam[] =
581 "TypedCountHalfLifeTime"; 628 "TypedCountHalfLifeTime";
582 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] = 629 const char OmniboxFieldTrial::kHUPNewScoringTypedCountScoreBucketsParam[] =
583 "TypedCountScoreBuckets"; 630 "TypedCountScoreBuckets";
584 const char OmniboxFieldTrial::kHUPNewScoringTypedCountUseDecayFactorParam[] = 631 const char OmniboxFieldTrial::kHUPNewScoringTypedCountUseDecayFactorParam[] =
585 "TypedCountUseDecayFactor"; 632 "TypedCountUseDecayFactor";
586 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] = 633 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountRelevanceCapParam[] =
587 "VisitedCountRelevanceCap"; 634 "VisitedCountRelevanceCap";
588 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] = 635 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountHalfLifeTimeParam[] =
589 "VisitedCountHalfLifeTime"; 636 "VisitedCountHalfLifeTime";
590 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] = 637 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountScoreBucketsParam[] =
591 "VisitedCountScoreBuckets"; 638 "VisitedCountScoreBuckets";
592 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] = 639 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] =
593 "VisitedCountUseDecayFactor"; 640 "VisitedCountUseDecayFactor";
594 641
595 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] = 642 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] =
596 "HQPExperimentalScoringBuckets"; 643 "HQPExperimentalScoringBuckets";
597 const char 644 const char
598 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = 645 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] =
599 "HQPExperimentalScoringTopicalityThreshold"; 646 "HQPExperimentalScoringTopicalityThreshold";
600 647
648 const char OmniboxFieldTrial::kPhysicalWebExperimentalScoringParam[] =
649 "PhysicalWebExperimentalScoring";
650 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] =
651 "PhysicalWebZeroSuggestBaseRelevance";
652 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] =
653 "PhysicalWebAfterTypingBaseRelevanceParam";
654
601 // static 655 // static
602 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; 656 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100;
603 657
604 // Background and implementation details: 658 // Background and implementation details:
605 // 659 //
606 // Each experiment group in any field trial can come with an optional set of 660 // Each experiment group in any field trial can come with an optional set of
607 // parameters (key-value pairs). In the bundled omnibox experiment 661 // parameters (key-value pairs). In the bundled omnibox experiment
608 // (kBundledExperimentFieldTrialName), each experiment group comes with a 662 // (kBundledExperimentFieldTrialName), each experiment group comes with a
609 // list of parameters in the form: 663 // list of parameters in the form:
610 // key=<Rule>: 664 // key=<Rule>:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 if (it != params.end()) 710 if (it != params.end())
657 return it->second; 711 return it->second;
658 // Fall back to the global instant extended context. 712 // Fall back to the global instant extended context.
659 it = params.find(rule + ":" + page_classification_str + ":*"); 713 it = params.find(rule + ":" + page_classification_str + ":*");
660 if (it != params.end()) 714 if (it != params.end())
661 return it->second; 715 return it->second;
662 // Look up rule in the global context. 716 // Look up rule in the global context.
663 it = params.find(rule + ":*:*"); 717 it = params.find(rule + ":*:*");
664 return (it != params.end()) ? it->second : std::string(); 718 return (it != params.end()) ? it->second : std::string();
665 } 719 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698