127 lines
6.3 KiB
Diff
127 lines
6.3 KiB
Diff
|
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||
|
Date: Fri, 24 Jan 2020 19:17:22 +0100
|
||
|
Subject: Disable smart selection by default
|
||
|
|
||
|
Allow web search in incognito mode; Smart Selection still
|
||
|
disabled in incognito as per upstream.
|
||
|
|
||
|
Partial revert of da1d809c003749846cb4ade8c11b6d038e44416b to restore
|
||
|
the ChromeSmartSelection feature flag.
|
||
|
|
||
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||
|
Change-Id: If123bca2e8ae02c746c3bf12f8287b8080c12ff7
|
||
|
---
|
||
|
.../contextualsearch/SelectionClientManager.java | 4 +++-
|
||
|
.../browser/flags/android/chrome_feature_list.cc | 5 +++++
|
||
|
.../browser/flags/android/chrome_feature_list.h | 1 +
|
||
|
.../chrome/browser/flags/ChromeFeatureList.java | 1 +
|
||
|
.../selection/SelectionPopupControllerImpl.java | 2 +-
|
||
|
testing/variations/fieldtrial_testing_config.json | 15 +++++++++++++++
|
||
|
6 files changed, 26 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManager.java
|
||
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManager.java
|
||
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/SelectionClientManager.java
|
||
|
@@ -10,6 +10,7 @@ import android.view.textclassifier.TextClassifier;
|
||
|
import androidx.annotation.Nullable;
|
||
|
import androidx.annotation.VisibleForTesting;
|
||
|
|
||
|
+import org.chromium.chrome.browser.flags.ChromeFeatureList;
|
||
|
import org.chromium.content_public.browser.SelectAroundCaretResult;
|
||
|
import org.chromium.content_public.browser.SelectionClient;
|
||
|
import org.chromium.content_public.browser.SelectionEventProcessor;
|
||
|
@@ -45,7 +46,8 @@ public class SelectionClientManager {
|
||
|
* @param webContents The {@link WebContents} that will show popups for this client.
|
||
|
*/
|
||
|
SelectionClientManager(WebContents webContents) {
|
||
|
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||
|
+ if (ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_SMART_SELECTION)
|
||
|
+ && Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
|
||
|
assert webContents != null;
|
||
|
mOptionalSelectionClient = SelectionClient.createSmartSelectionClient(webContents);
|
||
|
SelectionPopupController controller =
|
||
|
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
|
||
|
@@ -191,6 +191,7 @@ const base::Feature* const kFeaturesExposedToJava[] = {
|
||
|
&kCCTClientDataHeader,
|
||
|
&kCCTFeatureUsage,
|
||
|
&kCCTIncognito,
|
||
|
+ &kChromeSmartSelection,
|
||
|
&kCCTIncognitoAvailableToThirdParty,
|
||
|
&kCCTIntentFeatureOverrides,
|
||
|
&kCCTNewDownloadTab,
|
||
|
@@ -1015,6 +1016,10 @@ BASE_FEATURE(kDiscoverFeedMultiColumn,
|
||
|
"DiscoverFeedMultiColumn",
|
||
|
base::FEATURE_DISABLED_BY_DEFAULT);
|
||
|
|
||
|
+BASE_FEATURE(kChromeSmartSelection,
|
||
|
+ "ChromeSmartSelection",
|
||
|
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
||
|
+
|
||
|
BASE_FEATURE(kTabStripRedesign,
|
||
|
"TabStripRedesign",
|
||
|
base::FEATURE_DISABLED_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
|
||
|
@@ -70,6 +70,7 @@ BASE_DECLARE_FEATURE(kCCTToolbarCustomizations);
|
||
|
BASE_DECLARE_FEATURE(kDontAutoHideBrowserControls);
|
||
|
BASE_DECLARE_FEATURE(kCacheDeprecatedSystemLocationSetting);
|
||
|
BASE_DECLARE_FEATURE(kChromeNewDownloadTab);
|
||
|
+BASE_DECLARE_FEATURE(kChromeSmartSelection);
|
||
|
BASE_DECLARE_FEATURE(kChromeShareScreenshot);
|
||
|
BASE_DECLARE_FEATURE(kChromeSharingHub);
|
||
|
BASE_DECLARE_FEATURE(kChromeSharingHubLaunchAdjacent);
|
||
|
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
|
||
|
@@ -244,6 +244,7 @@ public abstract class ChromeFeatureList {
|
||
|
public static final String CCT_REAL_TIME_ENGAGEMENT_SIGNALS_ALTERNATIVE_IMPL =
|
||
|
"CCTRealTimeEngagementSignalsAlternativeImpl";
|
||
|
public static final String CCT_REDIRECT_PRECONNECT = "CCTRedirectPreconnect";
|
||
|
+ public static final String CHROME_SMART_SELECTION = "ChromeSmartSelection";
|
||
|
public static final String CCT_REMOVE_REMOTE_VIEW_IDS = "CCTRemoveRemoteViewIds";
|
||
|
public static final String CCT_REPORT_PARALLEL_REQUEST_STATUS =
|
||
|
"CCTReportParallelRequestStatus";
|
||
|
diff --git a/content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java b/content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java
|
||
|
--- a/content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java
|
||
|
+++ b/content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java
|
||
|
@@ -831,7 +831,7 @@ public class SelectionPopupControllerImpl extends ActionModeCallbackHelper
|
||
|
menu.removeItem(R.id.select_action_menu_share);
|
||
|
}
|
||
|
|
||
|
- if (isFocusedNodeEditable() || isIncognito()
|
||
|
+ if (isFocusedNodeEditable()
|
||
|
|| !isSelectActionModeAllowed(MENU_ITEM_WEB_SEARCH)) {
|
||
|
menu.removeItem(R.id.select_action_menu_web_search);
|
||
|
}
|
||
|
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
|
||
|
--- a/testing/variations/fieldtrial_testing_config.json
|
||
|
+++ b/testing/variations/fieldtrial_testing_config.json
|
||
|
@@ -3060,6 +3060,21 @@
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
+ "ChromeSmartSelection": [
|
||
|
+ {
|
||
|
+ "platforms": [
|
||
|
+ "android"
|
||
|
+ ],
|
||
|
+ "experiments": [
|
||
|
+ {
|
||
|
+ "name": "Enabled_Launch",
|
||
|
+ "enable_features": [
|
||
|
+ "ChromeSmartSelection"
|
||
|
+ ]
|
||
|
+ }
|
||
|
+ ]
|
||
|
+ }
|
||
|
+ ],
|
||
|
"CommerceHintAndroid": [
|
||
|
{
|
||
|
"platforms": [
|
||
|
--
|
||
|
2.40.1
|
||
|
|