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

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

Issue 2864103003: Limit the number of history urls indexed for omnibox suggestions. (Closed)
Patch Set: address comments. Created 3 years, 7 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 kPhysicalWebAfterTypingBaseRelevanceParam)); 625 kPhysicalWebAfterTypingBaseRelevanceParam));
626 int base_relevance; 626 int base_relevance;
627 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance)) 627 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance))
628 return base_relevance; 628 return base_relevance;
629 // Default relevance score of the first Physical Web URL autocomplete match 629 // Default relevance score of the first Physical Web URL autocomplete match
630 // when the user is typing in the omnibox. 630 // when the user is typing in the omnibox.
631 return 700; 631 return 700;
632 } 632 }
633 633
634 // static 634 // static
635 int OmniboxFieldTrial::MaxNumHQPUrlsIndexedAtStartup() {
Mark P 2017/05/10 17:23:09 nit: .cc function order should match .h order (I
ssid 2017/05/10 19:47:58 Sorry. I actually forgot to move this.
636 std::string param_value(variations::GetVariationParamValue(
637 kBundledExperimentFieldTrialName, kMaxNumHQPUrlsIndexedAtStartupParam));
638 int num_urls;
639 if (!param_value.empty() && base::StringToInt(param_value, &num_urls))
sdefresne 2017/05/10 08:59:41 nit: base::StringToInt returns false for empty str
ssid 2017/05/10 19:47:58 Done. Also some other functions have similar check
640 return num_urls;
641 // Default value is set to -1 for unlimited number of urls.
642 return -1;
643 }
644
645 // static
635 bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() { 646 bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() {
636 return base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome); 647 return base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome);
637 } 648 }
638 649
639 // static 650 // static
640 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() { 651 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() {
641 return base::GetFieldTrialParamValueByFeature( 652 return base::GetFieldTrialParamValueByFeature(
642 omnibox::kZeroSuggestRedirectToChrome, 653 omnibox::kZeroSuggestRedirectToChrome,
643 kZeroSuggestRedirectToChromeServerAddressParam); 654 kZeroSuggestRedirectToChromeServerAddressParam);
644 } 655 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 "HQPExperimentalScoringBuckets"; 730 "HQPExperimentalScoringBuckets";
720 const char 731 const char
721 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = 732 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] =
722 "HQPExperimentalScoringTopicalityThreshold"; 733 "HQPExperimentalScoringTopicalityThreshold";
723 734
724 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = 735 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] =
725 "PhysicalWebZeroSuggestBaseRelevance"; 736 "PhysicalWebZeroSuggestBaseRelevance";
726 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = 737 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] =
727 "PhysicalWebAfterTypingBaseRelevanceParam"; 738 "PhysicalWebAfterTypingBaseRelevanceParam";
728 739
740 const char OmniboxFieldTrial::kMaxNumHQPUrlsIndexedAtStartupParam[] =
741 "MaxNumHQPUrlsIndexedAtStartup";
742
729 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = 743 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] =
730 "ZeroSuggestRedirectToChromeServerAddress"; 744 "ZeroSuggestRedirectToChromeServerAddress";
731 const char 745 const char
732 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = 746 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] =
733 "ZeroSuggestRedirectToChromeAdditionalFields"; 747 "ZeroSuggestRedirectToChromeAdditionalFields";
734 748
735 // static 749 // static
736 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; 750 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100;
737 751
738 // Background and implementation details: 752 // Background and implementation details:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 if (it != params.end()) 804 if (it != params.end())
791 return it->second; 805 return it->second;
792 // Fall back to the global instant extended context. 806 // Fall back to the global instant extended context.
793 it = params.find(rule + ":" + page_classification_str + ":*"); 807 it = params.find(rule + ":" + page_classification_str + ":*");
794 if (it != params.end()) 808 if (it != params.end())
795 return it->second; 809 return it->second;
796 // Look up rule in the global context. 810 // Look up rule in the global context.
797 it = params.find(rule + ":*:*"); 811 it = params.find(rule + ":*:*");
798 return (it != params.end()) ? it->second : std::string(); 812 return (it != params.end()) ? it->second : std::string();
799 } 813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698