[omnibox][shortcut] Clean up shortcut expanding feature code.
Launched in m110 with crrev.com/c/4023398, which also launched rich
autocompletion.
Since rich AC only launched for desktop, that CL launched shortcut
expanding also for desktop only. But there's no reason to not launch
shortcut expansion for mobile as well.
Never ran mobile experiments, but that's fine, this feature never really
warranted experiments to begin with. Likewise, never ran desktop
experiments independent of rich AC.
Bug: 1062446
Change-Id: I89c38b8bdaa916d55b74aa8a4a5920d9f520f71b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4482698
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1137828}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 828de44d..6859e55 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -5729,10 +5729,6 @@
flag_descriptions::kOmniboxSiteSearchStarterPackName,
flag_descriptions::kOmniboxSiteSearchStarterPackDescription, kOsDesktop,
FEATURE_VALUE_TYPE(omnibox::kSiteSearchStarterPack)},
- {"omnibox-shortcut-expanding",
- flag_descriptions::kOmniboxShortcutExpandingName,
- flag_descriptions::kOmniboxShortcutExpandingDescription, kOsDesktop,
- FEATURE_VALUE_TYPE(omnibox::kShortcutExpanding)},
{"omnibox-close-popup-with-escape",
flag_descriptions::kOmniboxClosePopupWithEscapeName,
flag_descriptions::kOmniboxClosePopupWithEscapeDescription, kOsDesktop,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index ad29e16..ebb06dc 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -5745,11 +5745,6 @@
"expiry_milestone": 120
},
{
- "name": "omnibox-shortcut-expanding",
- "owners": [ "manukh", "chrome-omnibox-team@google.com" ],
- "expiry_milestone": 115
- },
- {
"name": "omnibox-site-search-starter-pack",
"owners": [ "yoangela", "chrome-omnibox-team@google.com" ],
"expiry_milestone": 107
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index e0ceccc..36349c21 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -2404,11 +2404,6 @@
const char kOmniboxShortcutBoostDescription[] =
"Promote shortcuts to be default when available.";
-const char kOmniboxShortcutExpandingName[] = "Omnibox shortcut expanding";
-const char kOmniboxShortcutExpandingDescription[] =
- "Expand the last word in the shortcut text to be a complete word from the "
- "suggestion text.";
-
const char kOmniboxSimplifiedUiUniformRowHeightName[] =
"Omnibox Suggestion Row Height";
const char kOmniboxSimplifiedUiUniformRowHeightDescription[] =
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc
index 003a689..417e44c 100644
--- a/components/omnibox/browser/omnibox_field_trial.cc
+++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -924,12 +924,6 @@
"ShortBookmarkSuggestionsByTotalInputLengthThreshold",
3);
-// Shortcut Expanding
-
-bool IsShortcutExpandingEnabled() {
- return base::FeatureList::IsEnabled(omnibox::kShortcutExpanding);
-}
-
// Shortcut boost
const base::FeatureParam<int> kShortcutBoostSearchScore(
&omnibox::kShortcutBoost,
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h
index f253bc4..669997e 100644
--- a/components/omnibox/browser/omnibox_field_trial.h
+++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -540,9 +540,6 @@
extern const base::FeatureParam<int>
kShortBookmarkSuggestionsByTotalInputLengthThreshold;
-// Shortcut Expanding.
-bool IsShortcutExpandingEnabled();
-
// Shortcut boost
// The scores to use for boosting search and URL suggestions respectively.
// Default to 1414 (`kScoreForBestInlineableResult` + 1). Setting to 0 will
diff --git a/components/omnibox/browser/shortcuts_backend.cc b/components/omnibox/browser/shortcuts_backend.cc
index f66535f..ff09f202 100644
--- a/components/omnibox/browser/shortcuts_backend.cc
+++ b/components/omnibox/browser/shortcuts_backend.cc
@@ -277,9 +277,7 @@
// inputs with trailing whitespace wouldn't match a shortcut even if the user
// previously used the input with a trailing whitespace.
const auto text_trimmed =
- OmniboxFieldTrial::IsShortcutExpandingEnabled()
- ? base::TrimWhitespace(text, base::TrimPositions::TRIM_TRAILING)
- : text;
+ base::TrimWhitespace(text, base::TrimPositions::TRIM_TRAILING);
// `text` may be empty for pedal and zero suggest navigations. `text_trimmed`
// can additionally be empty for whitespace-only inputs. It's unlikely users
@@ -316,9 +314,7 @@
const auto text_and_3_chars = base::StrCat(
{text_trimmed, it->second.text.substr(text_trimmed.length(), 3)});
const auto expanded_text =
- OmniboxFieldTrial::IsShortcutExpandingEnabled()
- ? ExpandToFullWord(text_and_3_chars, it->second.text)
- : text_and_3_chars;
+ ExpandToFullWord(text_and_3_chars, it->second.text);
UpdateShortcut(ShortcutsDatabase::Shortcut(
it->second.id, expanded_text,
MatchToMatchCore(match, template_url_service_,
@@ -339,12 +335,9 @@
// is usually also recognizable and helpful when there are whitespace or other
// discrepancies between the title and host (e.g. 'Stack Overflow' and
// 'stackoverflow.com').
- const auto expanded_text =
- OmniboxFieldTrial::IsShortcutExpandingEnabled()
- ? ExpandToFullWord(
- text, GetSwappedContents(match) + u" " +
- base::UTF8ToUTF16(match.destination_url.host()))
- : text;
+ const auto expanded_text = ExpandToFullWord(
+ text, GetSwappedContents(match) + u" " +
+ base::UTF8ToUTF16(match.destination_url.host()));
AddShortcut(ShortcutsDatabase::Shortcut(
base::Uuid::GenerateRandomV4().AsLowercaseString(), expanded_text,
MatchToMatchCore(match, template_url_service_, search_terms_data_.get()),
diff --git a/components/omnibox/browser/shortcuts_backend_unittest.cc b/components/omnibox/browser/shortcuts_backend_unittest.cc
index b5a4b801..baa096e0 100644
--- a/components/omnibox/browser/shortcuts_backend_unittest.cc
+++ b/components/omnibox/browser/shortcuts_backend_unittest.cc
@@ -411,7 +411,6 @@
}
TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_3CharShortening) {
- scoped_feature_list().InitAndEnableFeature(omnibox::kShortcutExpanding);
InitBackend();
AutocompleteMatch match;
@@ -465,7 +464,6 @@
}
TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_Expanding) {
- scoped_feature_list().InitAndEnableFeature(omnibox::kShortcutExpanding);
InitBackend();
AutocompleteMatch match;
@@ -612,7 +610,6 @@
// Test `ExpandToFullWord`, specifically focussing on detecting and handling
// the cases when `text` is a prefix of `match_text`.
- scoped_feature_list().InitAndEnableFeature(omnibox::kShortcutExpanding);
InitBackend();
const auto test = [&](const std::string& text, const std::string& match_text,
diff --git a/components/omnibox/browser/shortcuts_provider.cc b/components/omnibox/browser/shortcuts_provider.cc
index 5595aba..6f4c994 100644
--- a/components/omnibox/browser/shortcuts_provider.cc
+++ b/components/omnibox/browser/shortcuts_provider.cc
@@ -106,11 +106,10 @@
// Due to appending 3 chars when updating shortcuts, and expanding the last
// word when updating or creating shortcuts, the shortcut text can be longer
// than the user's previous inputs (see
- // `ShortcutsBackend::AddOrUpdateShortcut()`). As an approximation, ignore 3
- // or 10 chars in the shortcut text. Shortcuts are often deduped with higher
- // scoring history suggestions anyway.
- const size_t adjustment =
- OmniboxFieldTrial::IsShortcutExpandingEnabled() ? 10 : 3;
+ // `ShortcutsBackend::AddOrUpdateShortcut()`). As an approximation, ignore 10
+ // chars in the shortcut text. Shortcuts are often deduped with higher scoring
+ // history suggestions anyway.
+ const size_t adjustment = 10;
const size_t adjusted_text_length =
std::max(shortcut_text_length, typed_length + adjustment) - adjustment;
// Using the square root of the typed fraction boosts the base score rapidly
diff --git a/components/omnibox/browser/shortcuts_provider_unittest.cc b/components/omnibox/browser/shortcuts_provider_unittest.cc
index 4957a49..c75b2f4 100644
--- a/components/omnibox/browser/shortcuts_provider_unittest.cc
+++ b/components/omnibox/browser/shortcuts_provider_unittest.cc
@@ -279,14 +279,12 @@
// Even though these are enabled by default on desktop, they aren't enabled by
// default on mobile. To avoid having 2 sets of tests around, explicitly
// enable them for all platforms for tests.
- scoped_feature_list_.InitWithFeaturesAndParameters(
- {{omnibox::kRichAutocompletion,
- {{"RichAutocompletionAutocompleteTitlesShortcutProvider", "true"},
- {"RichAutocompletionAutocompleteTitlesMinChar", "3"},
- {"RichAutocompletionAutocompleteShortcutText", "true"},
- {"RichAutocompletionAutocompleteShortcutTextMinChar", "3"}}},
- {omnibox::kShortcutExpanding, {}}},
- {});
+ scoped_feature_list_.InitAndEnableFeatureWithParameters(
+ omnibox::kRichAutocompletion,
+ {{"RichAutocompletionAutocompleteTitlesShortcutProvider", "true"},
+ {"RichAutocompletionAutocompleteTitlesMinChar", "3"},
+ {"RichAutocompletionAutocompleteShortcutText", "true"},
+ {"RichAutocompletionAutocompleteShortcutTextMinChar", "3"}});
RichAutocompletionParams::ClearParamsForTesting();
}
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc
index 0ddfaaa..07ad436 100644
--- a/components/omnibox/common/omnibox_features.cc
+++ b/components/omnibox/common/omnibox_features.cc
@@ -297,12 +297,6 @@
"OmniboxShortBookmarkSuggestionsByTotalInputLength",
base::FEATURE_ENABLED_BY_DEFAULT);
-// If enabled, when updating or creating a shortcut, the last word of the input
-// is expanded, if possible, to a complete word in the suggestion description.
-BASE_FEATURE(kShortcutExpanding,
- "OmniboxShortcutExpanding",
- enabled_by_default_desktop_only);
-
// If enabled, the shortcut provider is more aggressive in scoring. The exact
// details will change over time; but ATM, the shortcut provider will chose 1
// candidate to compete with HUP's URL-what-you-typed suggestion for the default
diff --git a/components/omnibox/common/omnibox_features.h b/components/omnibox/common/omnibox_features.h
index bf24bfc..ef14222 100644
--- a/components/omnibox/common/omnibox_features.h
+++ b/components/omnibox/common/omnibox_features.h
@@ -74,7 +74,6 @@
BASE_DECLARE_FEATURE(kDisableCGIParamMatching);
BASE_DECLARE_FEATURE(kShortBookmarkSuggestions);
BASE_DECLARE_FEATURE(kShortBookmarkSuggestionsByTotalInputLength);
-BASE_DECLARE_FEATURE(kShortcutExpanding);
BASE_DECLARE_FEATURE(kShortcutBoost);
// TODO(crbug.com/1202964): Clean up feature flag used in staged roll-out of
// various CLs related to the contents/description clean-up work.