Android: Create a chrome flag for delegating overscroll swipes

The newly added flags, if turned on, always delegates overscroll
swipes to websites.

Bug: 865567
Change-Id: I1eb017c89f6519e64d34e097e9a115ea2f19d581
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1527948
Commit-Queue: Jinsuk Kim <[email protected]>
Reviewed-by: Theresa <[email protected]>
Cr-Commit-Position: refs/heads/master@{#642335}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
index d0450ca..5e49b1d2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -216,6 +216,7 @@
             "ContextualSuggestionsIPHReverseScroll";
     public static final String CUSTOM_CONTEXT_MENU = "CustomContextMenu";
     public static final String DATA_SAVER_LITE_MODE_REBRANDING = "DataSaverLiteModeRebranding";
+    public static final String DELEGATE_OVERSCROLL_SWIPES = "DelegateOverscrollSwipes";
     public static final String DONT_PREFETCH_LIBRARIES = "DontPrefetchLibraries";
     public static final String DOWNLOAD_HOME_SHOW_STORAGE_INFO = "DownloadHomeShowStorageInfo";
     public static final String DOWNLOAD_PROGRESS_INFOBAR = "DownloadProgressInfoBar";
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 0992141..a9d49f1d 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3776,6 +3776,10 @@
      flag_descriptions::kAndroidSiteSettingsUIRefreshName,
      flag_descriptions::kAndroidSiteSettingsUIRefreshDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::kAndroidSiteSettingsUIRefresh)},
+    {"delegate-overscroll-swipes",
+     flag_descriptions::kDelegateOverscrollSwipesName,
+     flag_descriptions::kDelegateOverscrollSwipesDescription, kOsAndroid,
+     FEATURE_VALUE_TYPE(chrome::android::kDelegateOverscrollSwipes)},
     {"translate-android-manual-trigger",
      flag_descriptions::kTranslateAndroidManualTriggerName,
      flag_descriptions::kTranslateAndroidManualTriggerDescription, kOsAndroid,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index 0d2972b..8e9f6f8 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -124,6 +124,7 @@
     &kContextualSearchTapDisableOverride,
     &kContextualSearchUnityIntegration,
     &kCustomContextMenu,
+    &kDelegateOverscrollSwipes,
     &kDontPrefetchLibraries,
     &kDownloadProgressInfoBar,
     &kDownloadHomeV2,
@@ -346,6 +347,9 @@
 const base::Feature kDontPrefetchLibraries{"DontPrefetchLibraries",
                                            base::FEATURE_DISABLED_BY_DEFAULT};
 
+const base::Feature kDelegateOverscrollSwipes{
+    "DelegateOverscrollSwipes", base::FEATURE_DISABLED_BY_DEFAULT};
+
 const base::Feature kDownloadAutoResumptionThrottling{
     "DownloadAutoResumptionThrottling", base::FEATURE_ENABLED_BY_DEFAULT};
 
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h
index 0a8cc45..51f7467 100644
--- a/chrome/browser/android/chrome_feature_list.h
+++ b/chrome/browser/android/chrome_feature_list.h
@@ -52,6 +52,7 @@
 extern const base::Feature kContextualSearchTapDisableOverride;
 extern const base::Feature kContextualSearchUnityIntegration;
 extern const base::Feature kCustomContextMenu;
+extern const base::Feature kDelegateOverscrollSwipes;
 extern const base::Feature kDontPrefetchLibraries;
 extern const base::Feature kDownloadAutoResumptionThrottling;
 extern const base::Feature kDownloadProgressInfoBar;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index c2ba21a..84e5a4ce 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -494,6 +494,11 @@
     "expiry_milestone": 88
   },
   {
+    "name": "delegate-overscroll-swipes",
+    // "owners": [ "your-team" ],
+    "expiry_milestone": 88
+  },
+  {
     "name": "device-discovery-notifications",
     // "owners": [ "your-team" ],
     "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 244aeb8..15365bf 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -76,6 +76,11 @@
     "Allow Chrome to offer to generate passwords when it detects account "
     "creation pages.";
 
+const char kDelegateOverscrollSwipesName[] =
+    "Delegate overscroll swipes to websites";
+const char kDelegateOverscrollSwipesDescription[] =
+    "Delegate overscroll swipes to websites first";
+
 const char kEnableBlinkHeapUnifiedGarbageCollectionName[] =
     "Blink Heap Unified Garbage Collection";
 const char kEnableBlinkHeapUnifiedGarbageCollectionDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 5b489d16..6657f67 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -169,6 +169,9 @@
 extern const char kCloudPrinterHandlerName[];
 extern const char kCloudPrinterHandlerDescription[];
 
+extern const char kDelegateOverscrollSwipesName[];
+extern const char kDelegateOverscrollSwipesDescription[];
+
 extern const char kExperimentalAccessibilityFeaturesName[];
 extern const char kExperimentalAccessibilityFeaturesDescription[];
 
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 9fc02b4..722a2df 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -32973,6 +32973,7 @@
   <int value="313303258" label="WebPaymentsModifiers:disabled"/>
   <int value="316182183" label="MediaDocumentDownloadButton:disabled"/>
   <int value="319683583" label="ContentSuggestionsDebugLog:enabled"/>
+  <int value="320121752" label="DelegateOverscrollSwipes:disabled"/>
   <int value="323605372" label="ui-disable-compositor-animation-timelines"/>
   <int value="324060906"
       label="enable-experimental-accessibility-language-detection"/>
@@ -34057,6 +34058,7 @@
   <int value="2039276757" label="EnableOverviewRoundedCorners:enabled"/>
   <int value="2040316611" label="IPH_ReopenTab:enabled"/>
   <int value="2043321329" label="OfflinePagesPrefetchingUI:disabled"/>
+  <int value="2047695652" label="DelegateOverscrollSwipes:enabled"/>
   <int value="2047981703" label="IntentPicker:enabled"/>
   <int value="2056572020" label="EnableUsernameCorrection:disabled"/>
   <int value="2058148069" label="UseMessagesStagingUrl:enabled"/>