Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 const base::Feature kSearchProviderWarmUpOnFocus{ | 78 const base::Feature kSearchProviderWarmUpOnFocus{ |
| 79 "OmniboxWarmUpSearchProviderOnFocus", base::FEATURE_DISABLED_BY_DEFAULT}; | 79 "OmniboxWarmUpSearchProviderOnFocus", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 80 | 80 |
| 81 // Feature used to enable the transmission of HTTPS URLs as part of the | 81 // Feature used to enable the transmission of HTTPS URLs as part of the |
| 82 // context to the suggest server (assuming SearchProvider is permitted to | 82 // context to the suggest server (assuming SearchProvider is permitted to |
| 83 // transmit URLs for context in the first place). | 83 // transmit URLs for context in the first place). |
| 84 const base::Feature kSearchProviderContextAllowHttpsUrls{ | 84 const base::Feature kSearchProviderContextAllowHttpsUrls{ |
| 85 "OmniboixSearchProviderContextAllowHttpsUrls", | 85 "OmniboixSearchProviderContextAllowHttpsUrls", |
| 86 base::FEATURE_DISABLED_BY_DEFAULT}; | 86 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 87 | 87 |
| 88 // Feature used for the Zero Suggest Redirect to Chrome Field Trial. | 88 // Feature used for the Zero Suggest Redirect to Chrome Field Trial |
|
Mark P
2017/07/18 19:11:29
nit: please restore the period. :-)
| |
| 89 const base::Feature kZeroSuggestRedirectToChrome{ | 89 const base::Feature kZeroSuggestRedirectToChrome{ |
| 90 "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; | 90 "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 91 | 91 |
| 92 // Feature used to swap the title and URL when providing zero suggest | 92 // Feature used to swap the title and URL when providing zero suggest |
| 93 // suggestions. | 93 // suggestions. |
| 94 const base::Feature kZeroSuggestSwapTitleAndUrl{ | 94 const base::Feature kZeroSuggestSwapTitleAndUrl{ |
| 95 "ZeroSuggestSwapTitleAndUrl", base::FEATURE_DISABLED_BY_DEFAULT}; | 95 "ZeroSuggestSwapTitleAndUrl", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 96 | 96 |
| 97 // Feature used to display the title of the current URL match. | 97 // Feature used to display the title of the current URL match. |
| 98 const base::Feature kDisplayTitleForCurrentUrl{ | 98 const base::Feature kDisplayTitleForCurrentUrl{ |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 kBundledExperimentFieldTrialName, | 693 kBundledExperimentFieldTrialName, |
| 694 kPhysicalWebAfterTypingBaseRelevanceParam)); | 694 kPhysicalWebAfterTypingBaseRelevanceParam)); |
| 695 int base_relevance; | 695 int base_relevance; |
| 696 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance)) | 696 if (!param_value.empty() && base::StringToInt(param_value, &base_relevance)) |
| 697 return base_relevance; | 697 return base_relevance; |
| 698 // Default relevance score of the first Physical Web URL autocomplete match | 698 // Default relevance score of the first Physical Web URL autocomplete match |
| 699 // when the user is typing in the omnibox. | 699 // when the user is typing in the omnibox. |
| 700 return 700; | 700 return 700; |
| 701 } | 701 } |
| 702 | 702 |
| 703 // static | |
| 704 bool OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial() { | |
| 705 return base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome); | |
| 706 } | |
| 707 | |
| 708 // static | |
| 709 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() { | |
| 710 return base::GetFieldTrialParamValueByFeature( | |
| 711 omnibox::kZeroSuggestRedirectToChrome, | |
| 712 kZeroSuggestRedirectToChromeServerAddressParam); | |
| 713 } | |
| 714 | |
| 715 // static | |
| 716 std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeAdditionalFields() { | |
| 717 return base::GetFieldTrialParamValueByFeature( | |
| 718 omnibox::kZeroSuggestRedirectToChrome, | |
| 719 kZeroSuggestRedirectToChromeAdditionalFieldsParam); | |
| 720 } | |
| 721 | |
| 722 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = | 703 const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] = |
| 723 "OmniboxBundledExperimentV1"; | 704 "OmniboxBundledExperimentV1"; |
| 724 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders"; | 705 const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders"; |
| 725 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = | 706 const char OmniboxFieldTrial::kShortcutsScoringMaxRelevanceRule[] = |
| 726 "ShortcutsScoringMaxRelevance"; | 707 "ShortcutsScoringMaxRelevance"; |
| 727 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; | 708 const char OmniboxFieldTrial::kSearchHistoryRule[] = "SearchHistory"; |
| 728 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; | 709 const char OmniboxFieldTrial::kDemoteByTypeRule[] = "DemoteByType"; |
| 729 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = | 710 const char OmniboxFieldTrial::kHQPBookmarkValueRule[] = |
| 730 "HQPBookmarkValue"; | 711 "HQPBookmarkValue"; |
| 731 const char OmniboxFieldTrial::kHQPTypedValueRule[] = "HQPTypedValue"; | 712 const char OmniboxFieldTrial::kHQPTypedValueRule[] = "HQPTypedValue"; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 "MaxNumHQPUrlsIndexedAtStartupOnLowEndDevices"; | 776 "MaxNumHQPUrlsIndexedAtStartupOnLowEndDevices"; |
| 796 const char | 777 const char |
| 797 OmniboxFieldTrial::kMaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevicesParam[] = | 778 OmniboxFieldTrial::kMaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevicesParam[] = |
| 798 "MaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevices"; | 779 "MaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevices"; |
| 799 | 780 |
| 800 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = | 781 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = |
| 801 "PhysicalWebZeroSuggestBaseRelevance"; | 782 "PhysicalWebZeroSuggestBaseRelevance"; |
| 802 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = | 783 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = |
| 803 "PhysicalWebAfterTypingBaseRelevanceParam"; | 784 "PhysicalWebAfterTypingBaseRelevanceParam"; |
| 804 | 785 |
| 805 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = | |
| 806 "ZeroSuggestRedirectToChromeServerAddress"; | |
| 807 const char | |
| 808 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = | |
| 809 "ZeroSuggestRedirectToChromeAdditionalFields"; | |
| 810 | |
| 811 const char OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam[] = | 786 const char OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam[] = |
| 812 "UIMaxAutocompleteMatches"; | 787 "UIMaxAutocompleteMatches"; |
| 813 const char OmniboxFieldTrial::kUIVerticalMarginParam[] = "UIVerticalMargin"; | 788 const char OmniboxFieldTrial::kUIVerticalMarginParam[] = "UIVerticalMargin"; |
| 814 | 789 |
| 815 // static | 790 // static |
| 816 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; | 791 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; |
| 817 | 792 |
| 818 // Background and implementation details: | 793 // Background and implementation details: |
| 819 // | 794 // |
| 820 // Each experiment group in any field trial can come with an optional set of | 795 // Each experiment group in any field trial can come with an optional set of |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 if (it != params.end()) | 845 if (it != params.end()) |
| 871 return it->second; | 846 return it->second; |
| 872 // Fall back to the global instant extended context. | 847 // Fall back to the global instant extended context. |
| 873 it = params.find(rule + ":" + page_classification_str + ":*"); | 848 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 874 if (it != params.end()) | 849 if (it != params.end()) |
| 875 return it->second; | 850 return it->second; |
| 876 // Look up rule in the global context. | 851 // Look up rule in the global context. |
| 877 it = params.find(rule + ":*:*"); | 852 it = params.find(rule + ":*:*"); |
| 878 return (it != params.end()) ? it->second : std::string(); | 853 return (it != params.end()) ? it->second : std::string(); |
| 879 } | 854 } |
| OLD | NEW |