Commit 84f1ddcc authored by Robbie Gibson's avatar Robbie Gibson Committed by Chromium LUCI CQ

[iOS] Add flag for local ZPS experiment

Bug: 1056781
Change-Id: Ie7c1421b4e6767d6f9714f75f2317555045ff951
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581920
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarTomasz Wiszkowski <ender@google.com>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835828}
parent 2c14389c
...@@ -3623,6 +3623,11 @@ ...@@ -3623,6 +3623,11 @@
"owners": [ "jdonnelly", "chrome-omnibox-team@google.com" ], "owners": [ "jdonnelly", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 89 "expiry_milestone": 89
}, },
{
"name": "omnibox-local-history-zero-suggest",
"owners": ["rkgibson@google.com", "stkhapugin", "chrome-omnibox-team@google.com"],
"expiry_milestone": 92
},
{ {
"name": "omnibox-local-zero-suggest-frecency-ranking", "name": "omnibox-local-zero-suggest-frecency-ranking",
"owners": [ "mahmadi", "chrome-omnibox-team@google.com" ], "owners": [ "mahmadi", "chrome-omnibox-team@google.com" ],
......
...@@ -58,17 +58,22 @@ base::string16 GetSearchTermsFromURL(const GURL& url, ...@@ -58,17 +58,22 @@ base::string16 GetSearchTermsFromURL(const GURL& url,
// Whether zero suggest suggestions are allowed in the given context. // Whether zero suggest suggestions are allowed in the given context.
// Invoked early, confirms all the conditions for zero suggestions are met. // Invoked early, confirms all the conditions for zero suggestions are met.
bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) { bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) {
// TODO: The default-enabling on Android predated the
// omnibox::kNewSearchFeatures flag, so Android is not gated by it. Because
// of that, the new kLocalHistoryZeroSuggest flag can't control Android
// behavior. Once the kNewSearchFeatures flag is removed,
// kLocalHistoryZeroSuggest can control the feature on all plattforms.
#if defined(OS_ANDROID) // Default-enabled on Android. #if defined(OS_ANDROID) // Default-enabled on Android.
return true; return true;
#else #else
if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures)) if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures))
return false; return false;
#endif
#if !defined(OS_IOS) // Enabled by default on Desktop if not disabled by // Flag is default-enabled on Android and Desktop.
// kNewSearchFeatures. if (base::FeatureList::IsEnabled(omnibox::kLocalHistoryZeroSuggest)) {
return true; return true;
#else }
const auto current_page_classification = input.current_page_classification(); const auto current_page_classification = input.current_page_classification();
// Reactive Zero-Prefix Suggestions (rZPS) and basically all remote ZPS on the // Reactive Zero-Prefix Suggestions (rZPS) and basically all remote ZPS on the
// NTP are expected to be displayed alongside local history zero-prefix // NTP are expected to be displayed alongside local history zero-prefix
...@@ -81,12 +86,6 @@ bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) { ...@@ -81,12 +86,6 @@ bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) {
omnibox::kReactiveZeroSuggestionsOnNTPOmnibox)) { omnibox::kReactiveZeroSuggestionsOnNTPOmnibox)) {
return true; return true;
} }
// NTP Realbox.
if (current_page_classification == OmniboxEventProto::NTP_REALBOX &&
base::FeatureList::IsEnabled(
omnibox::kReactiveZeroSuggestionsOnNTPRealbox)) {
return true;
}
return false; return false;
#endif #endif
......
...@@ -80,7 +80,7 @@ class LocalHistoryZeroSuggestProviderTest ...@@ -80,7 +80,7 @@ class LocalHistoryZeroSuggestProviderTest
#if defined(OS_IOS) // Only needed for iOS. #if defined(OS_IOS) // Only needed for iOS.
scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>();
scoped_feature_list_->InitAndEnableFeature( scoped_feature_list_->InitAndEnableFeature(
omnibox::kReactiveZeroSuggestionsOnNTPRealbox); omnibox::kLocalHistoryZeroSuggest);
#endif #endif
// Add the fallback default search provider to the TemplateURLService so // Add the fallback default search provider to the TemplateURLService so
...@@ -452,7 +452,7 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Ranking) { ...@@ -452,7 +452,7 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Ranking) {
// With frecency ranking disabled, more recent searches are ranked higher. // With frecency ranking disabled, more recent searches are ranked higher.
scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>();
scoped_feature_list_->InitWithFeatures( scoped_feature_list_->InitWithFeatures(
{omnibox::kReactiveZeroSuggestionsOnNTPRealbox}, // Enables the provider. {omnibox::kLocalHistoryZeroSuggest}, // Enables the provider on iOS.
{omnibox::kOmniboxLocalZeroSuggestFrecencyRanking}); {omnibox::kOmniboxLocalZeroSuggestFrecencyRanking});
StartProviderAndWaitUntilDone(); StartProviderAndWaitUntilDone();
...@@ -462,7 +462,7 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Ranking) { ...@@ -462,7 +462,7 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Ranking) {
// searches are just as frequent. // searches are just as frequent.
scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>();
scoped_feature_list_->InitWithFeatures( scoped_feature_list_->InitWithFeatures(
{omnibox::kReactiveZeroSuggestionsOnNTPRealbox, // Enables the provider. {omnibox::kLocalHistoryZeroSuggest, // Enables the provider on iOS.
omnibox::kOmniboxLocalZeroSuggestFrecencyRanking}, omnibox::kOmniboxLocalZeroSuggestFrecencyRanking},
{}); {});
...@@ -492,8 +492,8 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Freshness) { ...@@ -492,8 +492,8 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Freshness) {
// Override the age threshold to 7 days. // Override the age threshold to 7 days.
scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>();
scoped_feature_list_->InitWithFeaturesAndParameters( scoped_feature_list_->InitWithFeaturesAndParameters(
{{omnibox::kReactiveZeroSuggestionsOnNTPRealbox, // Enables the provider.
{}}, {{omnibox::kLocalHistoryZeroSuggest, {}}, // Enables the provider on iOS.
{omnibox::kOmniboxLocalZeroSuggestAgeThreshold, {omnibox::kOmniboxLocalZeroSuggestAgeThreshold,
{{OmniboxFieldTrial::kOmniboxLocalZeroSuggestAgeThresholdParam, "7"}}}}, {{OmniboxFieldTrial::kOmniboxLocalZeroSuggestAgeThresholdParam, "7"}}}},
{}); {});
......
...@@ -247,6 +247,10 @@ const base::Feature kReactiveZeroSuggestionsOnNTPRealbox{ ...@@ -247,6 +247,10 @@ const base::Feature kReactiveZeroSuggestionsOnNTPRealbox{
"OmniboxReactiveZeroSuggestionsOnNTPRealbox", "OmniboxReactiveZeroSuggestionsOnNTPRealbox",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Allows the LocalHistoryZeroSuggestProvider to use local search history.
const base::Feature kLocalHistoryZeroSuggest{
"LocalHistoryZeroSuggest", enabled_by_default_desktop_android};
// Features to provide non personalized head search suggestion from a compact // Features to provide non personalized head search suggestion from a compact
// on device model. More specifically, feature name with suffix Incognito / // on device model. More specifically, feature name with suffix Incognito /
// NonIncognito will only controls behaviors under incognito / non-incognito // NonIncognito will only controls behaviors under incognito / non-incognito
......
...@@ -66,6 +66,7 @@ extern const base::Feature kOnFocusSuggestionsContextualWeb; ...@@ -66,6 +66,7 @@ extern const base::Feature kOnFocusSuggestionsContextualWeb;
extern const base::Feature kOnFocusSuggestionsContextualWebOnContent; extern const base::Feature kOnFocusSuggestionsContextualWebOnContent;
extern const base::Feature kReactiveZeroSuggestionsOnNTPOmnibox; extern const base::Feature kReactiveZeroSuggestionsOnNTPOmnibox;
extern const base::Feature kReactiveZeroSuggestionsOnNTPRealbox; extern const base::Feature kReactiveZeroSuggestionsOnNTPRealbox;
extern const base::Feature kLocalHistoryZeroSuggest;
// Related, kMaxZeroSuggestMatches. // Related, kMaxZeroSuggestMatches.
// On Device Head Suggest. // On Device Head Suggest.
......
...@@ -338,6 +338,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = { ...@@ -338,6 +338,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
omnibox::kUIExperimentMaxAutocompleteMatches, omnibox::kUIExperimentMaxAutocompleteMatches,
kOmniboxUIMaxAutocompleteMatchesVariations, kOmniboxUIMaxAutocompleteMatchesVariations,
"OmniboxUIMaxAutocompleteVariations")}, "OmniboxUIMaxAutocompleteVariations")},
{"omnibox-local-history-zero-suggest",
flag_descriptions::kOmniboxLocalHistoryZeroSuggestName,
flag_descriptions::kOmniboxLocalHistoryZeroSuggestDescription,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(omnibox::kLocalHistoryZeroSuggest)},
{"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName, {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName,
flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos, flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kIOSInfobarUIReboot)}, FEATURE_VALUE_TYPE(kIOSInfobarUIReboot)},
......
...@@ -334,6 +334,12 @@ const char kOmniboxOnFocusSuggestionsDescription[] = ...@@ -334,6 +334,12 @@ const char kOmniboxOnFocusSuggestionsDescription[] =
"before the user has typed any input. This provides overrides for the " "before the user has typed any input. This provides overrides for the "
"default suggestion locations."; "default suggestion locations.";
const char kOmniboxLocalHistoryZeroSuggestName[] =
"Omnibox local zero-prefix suggestions";
const char kOmniboxLocalHistoryZeroSuggestDescription[] =
"Configures the omnibox zero-prefix suggestion to use local search "
"history.";
const char kRefactoredNTPName[] = "Enables refactored new tab page"; const char kRefactoredNTPName[] = "Enables refactored new tab page";
const char kRefactoredNTPDescription[] = const char kRefactoredNTPDescription[] =
"When enabled, the new tab page is replaced with the refactored version, " "When enabled, the new tab page is replaced with the refactored version, "
......
...@@ -291,6 +291,17 @@ extern const char kOmniboxOnDeviceHeadSuggestionsNonIncognitoDescription[]; ...@@ -291,6 +291,17 @@ extern const char kOmniboxOnDeviceHeadSuggestionsNonIncognitoDescription[];
extern const char kOmniboxOnFocusSuggestionsName[]; extern const char kOmniboxOnFocusSuggestionsName[];
extern const char kOmniboxOnFocusSuggestionsDescription[]; extern const char kOmniboxOnFocusSuggestionsDescription[];
// Title and description for the flag to control Omnibox Local zero-prefix
// suggestions.
extern const char kOmniboxLocalHistoryZeroSuggestName[];
extern const char kOmniboxLocalHistoryZeroSuggestDescription[];
#if defined(__IPHONE_13_4)
// Title and description for the flag to enable pointer support on tablets.
extern const char kPointerSupportName[];
extern const char kPointerSupportDescription[];
#endif // defined(__IPHONE_13_4)
// Title and description for the flag that enables the refactored new tab page. // Title and description for the flag that enables the refactored new tab page.
extern const char kRefactoredNTPName[]; extern const char kRefactoredNTPName[];
extern const char kRefactoredNTPDescription[]; extern const char kRefactoredNTPDescription[];
......
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