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

Unified Diff: components/omnibox/browser/omnibox_field_trial.cc

Issue 2716273004: Invert description and URL for experimental zero suggest suggestions. (Closed)
Patch Set: Initial fixes. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/omnibox_field_trial.cc
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc
index 935e2b1aa6e7617b04ad5416c91dd032fedd7e90..81452837bf14a1a621a1f13a0591edf0960f3264 100644
--- a/components/omnibox/browser/omnibox_field_trial.cc
+++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -523,14 +523,19 @@ int OmniboxFieldTrial::KeywordScoreForSufficientlyCompleteMatch() {
OmniboxFieldTrial::EmphasizeTitlesCondition
OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput(
- metrics::OmniboxInputType::Type input_type) {
- // Look up the parameter named kEmphasizeTitlesRule + ":" + input_type,
+ const AutocompleteInput& input) {
+ // First, check if we should emphasize titles for zero suggest suggestions.
+ if (input.from_omnibox_focus() &&
+ base::FeatureList::IsEnabled(features::kZeroSuggestSwapTitleAndUrl)) {
+ return EMPHASIZE_WHEN_NONEMPTY;
+ }
+ // Look up the parameter named kEmphasizeTitlesRule + ":" + input.type(),
// find its value, and return that value as an enum. If the parameter
// isn't redefined, fall back to the generic rule kEmphasizeTitlesRule + ":*"
std::string value_str(variations::GetVariationParamValue(
kBundledExperimentFieldTrialName,
std::string(kEmphasizeTitlesRule) + "_" +
- base::IntToString(static_cast<int>(input_type))));
+ base::IntToString(static_cast<int>(input.type()))));
if (value_str.empty()) {
value_str = variations::GetVariationParamValue(
kBundledExperimentFieldTrialName,
@@ -606,6 +611,11 @@ std::string OmniboxFieldTrial::ZeroSuggestRedirectToChromeAdditionalFields() {
kZeroSuggestRedirectToChromeAdditionalFieldsParam);
}
+// static
+bool OmniboxFieldTrial::InZeroSuggestSwapTitleAndUrlFieldTrial() {
+ return base::FeatureList::IsEnabled(features::kZeroSuggestSwapTitleAndUrl);
+}
+
const char OmniboxFieldTrial::kBundledExperimentFieldTrialName[] =
"OmniboxBundledExperimentV1";
const char OmniboxFieldTrial::kDisableProvidersRule[] = "DisableProviders";

Powered by Google App Engine
This is Rietveld 408576698