LeOSium_webview/LeOS/patches/Restore-Search-Ready-Omnibo...

168 lines
8.6 KiB
Diff
Raw Normal View History

2023-11-18 11:46:19 +01:00
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Thu, 10 Oct 2019 23:30:16 +0200
Subject: Restore Search Ready Omnibox flag
Revert "Cleanup Search Ready Omnibox flag since it has launched"
This reverts commit ae458edcc8422d0815d0e82261e71fe10d7d6fc2.
Disable search-ready omnibox by default
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/browser/about_flags.cc | 5 +++++
chrome/browser/flag-metadata.json | 5 +++++
chrome/browser/flag_descriptions.cc | 5 +++++
chrome/browser/flag_descriptions.h | 3 +++
chrome/browser/flags/android/chrome_feature_list.cc | 5 +++++
chrome/browser/flags/android/chrome_feature_list.h | 1 +
.../chrome/browser/flags/ChromeFeatureList.java | 1 +
.../suggestions/DropdownItemViewInfoListBuilder.java | 11 +++++++++--
8 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -9816,6 +9816,11 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kDesksTemplatesDescription, kOsCrOS,
FEATURE_VALUE_TYPE(ash::features::kDesksTemplates)},
#endif
+#if BUILDFLAG(IS_ANDROID)
+ {"enable-search-ready-omnibox", flag_descriptions::kSearchReadyOmniboxName,
+ flag_descriptions::kSearchReadyOmniboxDescription, kOsAndroid,
+ FEATURE_VALUE_TYPE(chrome::android::kSearchReadyOmniboxFeature)},
+#endif
{"large-favicon-from-google",
flag_descriptions::kLargeFaviconFromGoogleName,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -3329,6 +3329,11 @@
// Added feature, for testing. expiry deep in future.
"expiry_milestone": 116
},
+ {
+ "name": "enable-search-ready-omnibox",
+ "owners": [ "mdjones" ],
+ "expiry_milestone": -1
+ },
{
"name": "enable-parallel-downloading",
"owners": [ "qinmin", "xingliu", "dtrainor" ],
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -4425,6 +4425,11 @@ const char kSendTabToSelfV2Description[] =
"Enables new received tab "
"UI shown next to the profile icon instead of using system notifications.";
+const char kSearchReadyOmniboxName[] = "Search Ready Omnibox";
+const char kSearchReadyOmniboxDescription[] =
+ "Clears the omnibox and adds a suggestion item to share, copy, or edit the "
+ "URL.";
+
const char kSetMarketUrlForTestingName[] = "Set market URL for testing";
const char kSetMarketUrlForTestingDescription[] =
"When enabled, sets the market URL for use in testing the update menu "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -2601,6 +2601,9 @@ extern const char kShowScrollableMVTOnNTPAndroidDescription[];
extern const char kSendTabToSelfV2Name[];
extern const char kSendTabToSelfV2Description[];
+extern const char kSearchReadyOmniboxName[];
+extern const char kSearchReadyOmniboxDescription[];
+
extern const char kSetMarketUrlForTestingName[];
extern const char kSetMarketUrlForTestingDescription[];
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc
--- a/chrome/browser/flags/android/chrome_feature_list.cc
+++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -287,6 +287,7 @@ const base::Feature* const kFeaturesExposedToJava[] = {
&kReaderModeInCCT,
&kRecordSuppressionMetrics,
&kReengagementNotification,
+ &kSearchReadyOmniboxFeature,
&kRelatedSearches,
&kReportParentalControlSitesChild,
&kRequestDesktopSiteDefaults,
@@ -468,6 +469,10 @@ BASE_FEATURE(kAvoidSelectedTabFocusOnLayoutDoneShowing,
"AvoidSelectedTabFocusOnLayoutDoneShowing",
base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kSearchReadyOmniboxFeature,
+ "SearchReadyOmnibox",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
BASE_FEATURE(kFocusOmniboxInIncognitoTabIntents,
"FocusOmniboxInIncognitoTabIntents",
base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h
--- a/chrome/browser/flags/android/chrome_feature_list.h
+++ b/chrome/browser/flags/android/chrome_feature_list.h
@@ -170,6 +170,7 @@ BASE_DECLARE_FEATURE(kRequestDesktopSiteDefaultsDowngrade);
BASE_DECLARE_FEATURE(kRequestDesktopSiteDefaultsLogging);
BASE_DECLARE_FEATURE(kRestoreTabsOnFRE);
BASE_DECLARE_FEATURE(kSearchEnginesPromoV3);
+BASE_DECLARE_FEATURE(kSearchReadyOmniboxFeature);
BASE_DECLARE_FEATURE(kSharingHubLinkToggle);
BASE_DECLARE_FEATURE(kShowScrollableMVTOnNTPAndroid);
BASE_DECLARE_FEATURE(kFeedPositionAndroid);
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
--- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
+++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -320,6 +320,7 @@ public abstract class ChromeFeatureList {
"MessagesForAndroidInfrastructure";
public static final String MESSAGES_FOR_ANDROID_PERMISSION_UPDATE =
"MessagesForAndroidPermissionUpdate";
+ public static final String SEARCH_READY_OMNIBOX = "SearchReadyOmnibox";
public static final String METRICS_SETTINGS_ANDROID = "MetricsSettingsAndroid";
public static final String NEW_TAB_SEARCH_ENGINE_URL_ANDROID = "NewTabSearchEngineUrlAndroid";
public static final String NOTIFICATION_PERMISSION_VARIANT = "NotificationPermissionVariant";
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/DropdownItemViewInfoListBuilder.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/DropdownItemViewInfoListBuilder.java
--- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/DropdownItemViewInfoListBuilder.java
+++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/DropdownItemViewInfoListBuilder.java
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.VisibleForTesting;
+import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.omnibox.OmniboxFeatures;
import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider;
@@ -56,6 +57,7 @@ class DropdownItemViewInfoListBuilder {
@Px
private int mDropdownHeight;
private OpenHistoryClustersDelegate mOpenHistoryClustersDelegate;
+ private EditUrlSuggestionProcessor mEditUrlSuggestionProcessor;
DropdownItemViewInfoListBuilder(@NonNull Supplier<Tab> tabSupplier, BookmarkState bookmarkState,
OpenHistoryClustersDelegate openHistoryClustersDelegate) {
@@ -91,8 +93,10 @@ class DropdownItemViewInfoListBuilder {
mDividerLineProcessor = new DividerLineProcessor(context);
}
mHeaderProcessor = new HeaderProcessor(context);
- registerSuggestionProcessor(new EditUrlSuggestionProcessor(
- context, host, mImageSupplier, mActivityTabSupplier, shareSupplier));
+ mEditUrlSuggestionProcessor = new EditUrlSuggestionProcessor(
+ context, host, mImageSupplier, mActivityTabSupplier, shareSupplier);
+ registerSuggestionProcessor(mEditUrlSuggestionProcessor);
+
registerSuggestionProcessor(
new AnswerSuggestionProcessor(context, host, textProvider, mImageSupplier));
registerSuggestionProcessor(
@@ -201,6 +205,9 @@ class DropdownItemViewInfoListBuilder {
/** Signals that native initialization has completed. */
void onNativeInitialized() {
mHeaderProcessor.onNativeInitialized();
+ if (ChromeFeatureList.isEnabled(ChromeFeatureList.SEARCH_READY_OMNIBOX) == false) {
+ mPriorityOrderedSuggestionProcessors.remove(mEditUrlSuggestionProcessor);
+ }
for (int index = 0; index < mPriorityOrderedSuggestionProcessors.size(); index++) {
mPriorityOrderedSuggestionProcessors.get(index).onNativeInitialized();
}
--
2.25.1