Commit 675f6395 authored by Ce Chen's avatar Ce Chen Committed by Chromium LUCI CQ

[omnibox] launch on device head suggest on Desktop non-Incognito.

The variant to be launched: http://screenshot/6pp7qvc8gfMGyxm

Bug: 925072
Change-Id: I931f6a2432466d1b3692773256634aaad12d14dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2578505Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Ce Chen <cch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835541}
parent faf0da6d
......@@ -781,13 +781,18 @@ std::string OmniboxFieldTrial::OnDeviceHeadModelLocaleConstraint(
}
int OmniboxFieldTrial::OnDeviceHeadSuggestMaxScoreForNonUrlInput(
bool is_incognito,
const int default_score) {
bool is_incognito) {
const int kDefaultScore =
#if defined(OS_ANDROID) || defined(OS_IOS)
99;
#else
is_incognito ? 99 : 1000;
#endif // defined(OS_ANDROID) || defined(OS_IOS)
return is_incognito
? default_score
? kDefaultScore
: base::GetFieldTrialParamByFeatureAsInt(
omnibox::kOnDeviceHeadProviderNonIncognito,
kOnDeviceHeadSuggestMaxScoreForNonUrlInput, default_score);
kOnDeviceHeadSuggestMaxScoreForNonUrlInput, kDefaultScore);
}
int OmniboxFieldTrial::OnDeviceHeadSuggestDelaySuggestRequestMs(
......@@ -814,9 +819,14 @@ int OmniboxFieldTrial::OnDeviceSearchProviderDefaultLoaderTimeoutMs(
}
std::string OmniboxFieldTrial::OnDeviceHeadSuggestDemoteMode() {
return base::GetFieldTrialParamValueByFeature(
std::string demote_mode = base::GetFieldTrialParamValueByFeature(
omnibox::kOnDeviceHeadProviderNonIncognito,
kOnDeviceHeadSuggestDemoteMode);
#if !defined(OS_ANDROID) && !defined(OS_IOS)
if (demote_mode.empty())
demote_mode = "decrease-relevances";
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
return demote_mode;
}
bool OmniboxFieldTrial::ShouldRevealPathQueryRefOnHover() {
......
......@@ -417,8 +417,7 @@ bool IsOnDeviceHeadSuggestEnabledForNonIncognito();
bool IsOnDeviceHeadSuggestEnabledForAnyMode();
// Functions can be used in both non-incognito and incognito.
std::string OnDeviceHeadModelLocaleConstraint(bool is_incognito);
int OnDeviceHeadSuggestMaxScoreForNonUrlInput(bool is_incognito,
const int default_score);
int OnDeviceHeadSuggestMaxScoreForNonUrlInput(bool is_incognito);
int OnDeviceSearchProviderDefaultLoaderTimeoutMs(bool is_incognito);
int OnDeviceHeadSuggestDelaySuggestRequestMs(bool is_incognito);
// Function only works in non-incognito when server suggestions are available.
......
......@@ -30,7 +30,7 @@
#include "third_party/metrics_proto/omnibox_input_type.pb.h"
namespace {
const int kBaseRelevance = 99;
const int kBaseRelevanceForUrlInput = 99;
const size_t kMaxRequestId = std::numeric_limits<size_t>::max() - 1;
bool IsDefaultSearchProviderGoogle(
......@@ -262,9 +262,9 @@ void OnDeviceHeadProvider::SearchDone(
int relevance =
params->input.type() == metrics::OmniboxInputType::URL
? kBaseRelevance
? kBaseRelevanceForUrlInput
: OmniboxFieldTrial::OnDeviceHeadSuggestMaxScoreForNonUrlInput(
client()->IsOffTheRecord(), kBaseRelevance);
client()->IsOffTheRecord());
for (const auto& item : params->suggestions) {
matches_.push_back(BaseSearchProvider::CreateOnDeviceSearchSuggestion(
......
......@@ -36,12 +36,13 @@ const auto enabled_by_default_desktop_ios =
base::FEATURE_ENABLED_BY_DEFAULT;
#endif
const auto enabled_by_default_android_ios =
#if defined(OS_ANDROID) || defined(OS_IOS)
base::FEATURE_ENABLED_BY_DEFAULT;
#else
base::FEATURE_DISABLED_BY_DEFAULT;
#endif
// Comment out this macro since it is currently not being used in this file.
// const auto enabled_by_default_android_ios =
// #if defined(OS_ANDROID) || defined(OS_IOS)
// base::FEATURE_ENABLED_BY_DEFAULT;
// #else
// base::FEATURE_DISABLED_BY_DEFAULT;
// #endif
// Allows Omnibox to dynamically adjust number of offered suggestions to fill in
// the space between Omnibox an the soft keyboard. The number of suggestions
......@@ -253,7 +254,8 @@ const base::Feature kReactiveZeroSuggestionsOnNTPRealbox{
const base::Feature kOnDeviceHeadProviderIncognito{
"OmniboxOnDeviceHeadProviderIncognito", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kOnDeviceHeadProviderNonIncognito{
"OmniboxOnDeviceHeadProviderNonIncognito", enabled_by_default_android_ios};
"OmniboxOnDeviceHeadProviderNonIncognito",
base::FEATURE_ENABLED_BY_DEFAULT};
// If enabled, changes the way Google-provided search suggestions are scored by
// the backend. Note that this Feature is only used for triggering a server-
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment