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" |
| 11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/field_trial_params.h" | 13 #include "base/metrics/field_trial_params.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "components/metrics/proto/omnibox_event.pb.h" | 19 #include "components/metrics/proto/omnibox_event.pb.h" |
| 20 #include "components/omnibox/browser/omnibox_field_trial.h" | |
|
Mark P
2017/05/03 18:38:59
nit: this is already included above.
tommycli
2017/05/03 18:49:46
Done. Oops brain fart!
| |
| 20 #include "components/omnibox/browser/omnibox_switches.h" | 21 #include "components/omnibox/browser/omnibox_switches.h" |
| 21 #include "components/omnibox/browser/url_index_private_data.h" | 22 #include "components/omnibox/browser/url_index_private_data.h" |
| 22 #include "components/search/search.h" | 23 #include "components/search/search.h" |
| 23 #include "components/variations/active_field_trials.h" | 24 #include "components/variations/active_field_trials.h" |
| 24 #include "components/variations/metrics_util.h" | 25 #include "components/variations/metrics_util.h" |
| 25 #include "components/variations/variations_associated_data.h" | 26 #include "components/variations/variations_associated_data.h" |
| 26 | 27 |
| 27 using metrics::OmniboxEventProto; | 28 using metrics::OmniboxEventProto; |
| 28 | 29 |
| 29 namespace omnibox { | 30 namespace omnibox { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 | 74 |
| 74 // Feature used to swap the title and URL when providing zero suggest | 75 // Feature used to swap the title and URL when providing zero suggest |
| 75 // suggestions. | 76 // suggestions. |
| 76 const base::Feature kZeroSuggestSwapTitleAndUrl{ | 77 const base::Feature kZeroSuggestSwapTitleAndUrl{ |
| 77 "ZeroSuggestSwapTitleAndUrl", base::FEATURE_DISABLED_BY_DEFAULT}; | 78 "ZeroSuggestSwapTitleAndUrl", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 78 | 79 |
| 79 // Feature used to display the title of the current URL match. | 80 // Feature used to display the title of the current URL match. |
| 80 const base::Feature kDisplayTitleForCurrentUrl{ | 81 const base::Feature kDisplayTitleForCurrentUrl{ |
| 81 "OmniboxDisplayTitleForCurrentUrl", base::FEATURE_DISABLED_BY_DEFAULT}; | 82 "OmniboxDisplayTitleForCurrentUrl", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 82 | 83 |
| 84 // Feature used for UI experiments. | |
| 85 const base::Feature kUIExperiments{"OmniboxUIExperiments", | |
| 86 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 87 | |
| 83 } // namespace omnibox | 88 } // namespace omnibox |
| 84 | 89 |
| 85 namespace { | 90 namespace { |
| 86 | 91 |
| 87 typedef std::map<std::string, std::string> VariationParams; | 92 typedef std::map<std::string, std::string> VariationParams; |
| 88 typedef HUPScoringParams::ScoreBuckets ScoreBuckets; | 93 typedef HUPScoringParams::ScoreBuckets ScoreBuckets; |
| 89 | 94 |
| 90 // Field trial names. | 95 // Field trial names. |
| 91 const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; | 96 const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; |
| 92 | 97 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 "PhysicalWebZeroSuggestBaseRelevance"; | 734 "PhysicalWebZeroSuggestBaseRelevance"; |
| 730 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = | 735 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = |
| 731 "PhysicalWebAfterTypingBaseRelevanceParam"; | 736 "PhysicalWebAfterTypingBaseRelevanceParam"; |
| 732 | 737 |
| 733 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = | 738 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = |
| 734 "ZeroSuggestRedirectToChromeServerAddress"; | 739 "ZeroSuggestRedirectToChromeServerAddress"; |
| 735 const char | 740 const char |
| 736 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = | 741 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = |
| 737 "ZeroSuggestRedirectToChromeAdditionalFields"; | 742 "ZeroSuggestRedirectToChromeAdditionalFields"; |
| 738 | 743 |
| 744 const char OmniboxFieldTrial::kUIExperimentsVerticalMarginParam[] = | |
| 745 "UIExperimentsVerticalMargin"; | |
| 746 | |
| 739 // static | 747 // static |
| 740 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; | 748 int OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 100; |
| 741 | 749 |
| 742 // Background and implementation details: | 750 // Background and implementation details: |
| 743 // | 751 // |
| 744 // Each experiment group in any field trial can come with an optional set of | 752 // Each experiment group in any field trial can come with an optional set of |
| 745 // parameters (key-value pairs). In the bundled omnibox experiment | 753 // parameters (key-value pairs). In the bundled omnibox experiment |
| 746 // (kBundledExperimentFieldTrialName), each experiment group comes with a | 754 // (kBundledExperimentFieldTrialName), each experiment group comes with a |
| 747 // list of parameters in the form: | 755 // list of parameters in the form: |
| 748 // key=<Rule>: | 756 // key=<Rule>: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 if (it != params.end()) | 802 if (it != params.end()) |
| 795 return it->second; | 803 return it->second; |
| 796 // Fall back to the global instant extended context. | 804 // Fall back to the global instant extended context. |
| 797 it = params.find(rule + ":" + page_classification_str + ":*"); | 805 it = params.find(rule + ":" + page_classification_str + ":*"); |
| 798 if (it != params.end()) | 806 if (it != params.end()) |
| 799 return it->second; | 807 return it->second; |
| 800 // Look up rule in the global context. | 808 // Look up rule in the global context. |
| 801 it = params.find(rule + ":*:*"); | 809 it = params.find(rule + ":*:*"); |
| 802 return (it != params.end()) ? it->second : std::string(); | 810 return (it != params.end()) ? it->second : std::string(); |
| 803 } | 811 } |
| OLD | NEW |