Commit 83ce43ca authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Add an override Feature for treatment of HTTP

Adds a default-disabled Feature to override the policy that Contextual
Search applies to plain HTTP pages. This allows disabling the recent
change that treats HTTP just like HTTPS landed in
https://crrev.com/c/2393526. Enabling the Feature will allow us to go
back to the legacy policy, and allow us to measure the impact of the
policy change accurately.

BUG=1124397,1129969

Change-Id: If9ceab183053a573b45a3db6051b55c625c21755
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422264
Commit-Queue: Donn Denman <donnd@chromium.org>
Commit-Queue: Theresa  <twellington@chromium.org>
Auto-Submit: Donn Denman <donnd@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809473}
parent f2f4de88
......@@ -153,7 +153,8 @@ class ContextualSearchPolicy {
return false;
}
return !isUserUndecided(); // The user must have decided on privacy to resolve page content.
// The user must have decided on privacy to resolve page content on HTTPS.
return !isUserUndecided() || doesLegacyHttpPolicyApply();
}
/** @return Whether a long-press gesture can resolve. */
......@@ -169,7 +170,8 @@ class ContextualSearchPolicy {
boolean canSendSurroundings() {
if (mDidOverrideDecidedStateForTesting) return mDecidedStateForTesting;
return !isUserUndecided(); // The user must have decided on privacy to send page content.
// The user must have decided on privacy to send page content on HTTPS.
return !isUserUndecided() || doesLegacyHttpPolicyApply();
}
/**
......@@ -271,6 +273,19 @@ class ContextualSearchPolicy {
ContextualSearchFieldTrial.LONGPRESS_RESOLVE_PARAM_NAME));
}
/**
* Determines the policy for sending page content when on plain HTTP pages.
* Checks a Feature to use our legacy HTTP policy instead of treating HTTP just like HTTPS.
* See https://crbug.com/1129969 for details.
* @return whether the legacy policy for plain HTTP pages currently applies.
*/
private boolean doesLegacyHttpPolicyApply() {
if (!isBasePageHTTP(mNetworkCommunicator.getBasePageUrl())) return false;
// Check if the legacy behavior is enabled through a feature.
return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SEARCH_LEGACY_HTTP_POLICY);
}
/**
* Determines whether an error from a search term resolution request should
* be shown to the user, or not.
......
......@@ -142,6 +142,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kContextMenuSearchAndShopWithGoogleLens,
&kContextualSearchDebug,
&kContextualSearchDefinitions,
&kContextualSearchLegacyHttpPolicy,
&kContextualSearchLongpressResolve,
&kContextualSearchMlTapSuppression,
&kContextualSearchSecondTap,
......@@ -403,6 +404,9 @@ const base::Feature kContextualSearchDebug{"ContextualSearchDebug",
const base::Feature kContextualSearchDefinitions{
"ContextualSearchDefinitions", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kContextualSearchLegacyHttpPolicy{
"ContextualSearchLegacyHttpPolicy", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kContextualSearchLongpressResolve{
"ContextualSearchLongpressResolve", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -52,6 +52,7 @@ extern const base::Feature kContextMenuSearchAndShopWithGoogleLens;
extern const base::Feature kContentSuggestionsScrollToLoad;
extern const base::Feature kContextualSearchDebug;
extern const base::Feature kContextualSearchDefinitions;
extern const base::Feature kContextualSearchLegacyHttpPolicy;
extern const base::Feature kContextualSearchLongpressResolve;
extern const base::Feature kContextualSearchMlTapSuppression;
extern const base::Feature kContextualSearchSecondTap;
......
......@@ -258,6 +258,8 @@ public abstract class ChromeFeatureList {
"ContextMenuSearchAndShopWithGoogleLens";
public static final String CONTEXTUAL_SEARCH_DEBUG = "ContextualSearchDebug";
public static final String CONTEXTUAL_SEARCH_DEFINITIONS = "ContextualSearchDefinitions";
public static final String CONTEXTUAL_SEARCH_LEGACY_HTTP_POLICY =
"ContextualSearchLegacyHttpPolicy";
public static final String CONTEXTUAL_SEARCH_ML_TAP_SUPPRESSION =
"ContextualSearchMlTapSuppression";
public static final String CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE =
......
......@@ -42337,6 +42337,7 @@ from previous Chrome versions.
<int value="-474806100" label="DataReductionProxyMainMenu:enabled"/>
<int value="-474322576" label="disable-quick-unlock-pin"/>
<int value="-473087416" label="DragTabsInTabletMode:enabled"/>
<int value="-473052940" label="ContextualSearchLegacyHttpPolicy:enabled"/>
<int value="-472477695" label="AutofillSaveCardImprovedUserConsent:enabled"/>
<int value="-472014137" label="HomepageTile:disabled"/>
<int value="-472013317" label="WebRTC-H264WithOpenH264FFmpeg:disabled"/>
......@@ -42622,6 +42623,7 @@ from previous Chrome versions.
label="WebPaymentsPerMethodCanMakePaymentQuota:enabled"/>
<int value="-174564579"
label="ServiceWorkerImportedScriptUpdateCheck:enabled"/>
<int value="-174425466" label="ContextualSearchLegacyHttpPolicy:disabled"/>
<int value="-174319545" label="BulkPrinters:enabled"/>
<int value="-173268856" label="GesturePropertiesDBusService"/>
<int value="-171232290" label="ListAllDisplayModes:disabled"/>
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