| 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 #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 Loading... |
| 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::MaxNumHistoryUrlsIndexedAtStartup() { |
| 636 std::string param_value(variations::GetVariationParamValue( |
| 637 kBundledExperimentFieldTrialName, |
| 638 kMaxNumHistoryUrlsIndexedAtStartupParam)); |
| 639 int num_urls; |
| 640 if (!param_value.empty() && base::StringToInt(param_value, &num_urls)) |
| 641 return num_urls; |
| 642 // Default value is set to -1 for unlimited number of urls. |
| 643 return -1; |
| 644 } |
| 645 |
| 646 // static |
| 635 bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() { | 647 bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() { |
| 636 return base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome); | 648 return base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome); |
| 637 } | 649 } |
| 638 | 650 |
| 639 // static | 651 // static |
| 640 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() { | 652 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() { |
| 641 return base::GetFieldTrialParamValueByFeature( | 653 return base::GetFieldTrialParamValueByFeature( |
| 642 omnibox::kZeroSuggestRedirectToChrome, | 654 omnibox::kZeroSuggestRedirectToChrome, |
| 643 kZeroSuggestRedirectToChromeServerAddressParam); | 655 kZeroSuggestRedirectToChromeServerAddressParam); |
| 644 } | 656 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 "HQPExperimentalScoringBuckets"; | 731 "HQPExperimentalScoringBuckets"; |
| 720 const char | 732 const char |
| 721 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = | 733 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = |
| 722 "HQPExperimentalScoringTopicalityThreshold"; | 734 "HQPExperimentalScoringTopicalityThreshold"; |
| 723 | 735 |
| 724 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = | 736 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = |
| 725 "PhysicalWebZeroSuggestBaseRelevance"; | 737 "PhysicalWebZeroSuggestBaseRelevance"; |
| 726 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = | 738 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = |
| 727 "PhysicalWebAfterTypingBaseRelevanceParam"; | 739 "PhysicalWebAfterTypingBaseRelevanceParam"; |
| 728 | 740 |
| 741 const char OmniboxFieldTrial::kMaxNumHistoryUrlsIndexedAtStartupParam[] = |
| 742 "MaxNumHistoryUrlsIndexedAtStartup"; |
| 743 |
| 729 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = | 744 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = |
| 730 "ZeroSuggestRedirectToChromeServerAddress"; | 745 "ZeroSuggestRedirectToChromeServerAddress"; |
| 731 const char | 746 const char |
| 732 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = | 747 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = |
| 733 "ZeroSuggestRedirectToChromeAdditionalFields"; | 748 "ZeroSuggestRedirectToChromeAdditionalFields"; |
| 734 | 749 |
| 735 // static | 750 // static |
| 736 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; | 751 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; |
| 737 | 752 |
| 738 // Background and implementation details: | 753 // Background and implementation details: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (it != params.end()) | 805 if (it != params.end()) |
| 791 return it->second; | 806 return it->second; |
| 792 // Fall back to the global instant extended context. | 807 // Fall back to the global instant extended context. |
| 793 it = params.find(rule + ":" + page_classification_str + ":*"); | 808 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 794 if (it != params.end()) | 809 if (it != params.end()) |
| 795 return it->second; | 810 return it->second; |
| 796 // Look up rule in the global context. | 811 // Look up rule in the global context. |
| 797 it = params.find(rule + ":*:*"); | 812 it = params.find(rule + ":*:*"); |
| 798 return (it != params.end()) ? it->second : std::string(); | 813 return (it != params.end()) ? it->second : std::string(); |
| 799 } | 814 } |
| OLD | NEW |