Commit f566ac6a authored by Yi Gu's avatar Yi Gu Committed by Chromium LUCI CQ

[WebOTP] Prepare Finch experiment for features::kWebOtpBackend

We plan to ship the new CodeBrowser backend of WebOTP via Finch. This
patch adds necessary code on the client side.

Bug: 1153880
Change-Id: I550ff16d34ec638a0275007b2e1481dec8295115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580539
Commit-Queue: Yi Gu <yigu@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarMajid Valipour <majidvp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836321}
parent fe4f25ed
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/android/content_jni_headers/SmsProviderGms_jni.h" #include "content/public/android/content_jni_headers/SmsProviderGms_jni.h"
...@@ -21,11 +22,15 @@ using base::android::ConvertJavaStringToUTF8; ...@@ -21,11 +22,15 @@ using base::android::ConvertJavaStringToUTF8;
namespace content { namespace content {
SmsProviderGms::SmsProviderGms() { SmsProviderGms::SmsProviderGms() {
// For backward compat if there is no value provided for switch assume we use // The backend depends on |features::kWebOtpBackendAuto| which is controlled
// user consent backend. // by both a Finch experiment and chrome://flags. If the feature is enabled,
// TODO(majidvp): Change this to be the auto backend once that is fully // the "Auto" backend will be used. If not, for backward compatibility we use
// launched http://crbug.com/1101050 // the "UserConsent" backend. Note: in case of any conflict between finch and
GmsBackend backend = GmsBackend::kUserConsent; // chrome flags, the latter takes precedence.
GmsBackend backend =
base::FeatureList::IsEnabled(features::kWebOtpBackendAuto)
? GmsBackend::kAuto
: GmsBackend::kUserConsent;
auto switch_value = auto switch_value =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
......
...@@ -859,10 +859,10 @@ const base::Feature kWebID{"WebID", base::FEATURE_DISABLED_BY_DEFAULT}; ...@@ -859,10 +859,10 @@ const base::Feature kWebID{"WebID", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kExperimentalProductivityFeatures{ const base::Feature kExperimentalProductivityFeatures{
"ExperimentalProductivityFeatures", base::FEATURE_DISABLED_BY_DEFAULT}; "ExperimentalProductivityFeatures", base::FEATURE_DISABLED_BY_DEFAULT};
// When this feature is enabled, the Web OTP API will use the User Consent // Controls which backend is used to retrieve OTP on Android. When disabled
// API to retrieve SMSes from the Android device. // we use User Consent API.
const base::Feature kWebOtpBackend{"WebOtpBackend", const base::Feature kWebOtpBackendAuto{"WebOtpBackendAuto",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// The JavaScript API for payments on the web. // The JavaScript API for payments on the web.
const base::Feature kWebPayments{"WebPayments", const base::Feature kWebPayments{"WebPayments",
......
...@@ -193,7 +193,7 @@ CONTENT_EXPORT extern const base::Feature kWebBundlesFromNetwork; ...@@ -193,7 +193,7 @@ CONTENT_EXPORT extern const base::Feature kWebBundlesFromNetwork;
CONTENT_EXPORT extern const base::Feature kWebContentsOcclusion; CONTENT_EXPORT extern const base::Feature kWebContentsOcclusion;
CONTENT_EXPORT extern const base::Feature kWebGLImageChromium; CONTENT_EXPORT extern const base::Feature kWebGLImageChromium;
CONTENT_EXPORT extern const base::Feature kWebID; CONTENT_EXPORT extern const base::Feature kWebID;
CONTENT_EXPORT extern const base::Feature kWebOtpBackend; CONTENT_EXPORT extern const base::Feature kWebOtpBackendAuto;
CONTENT_EXPORT extern const base::Feature kWebPayments; CONTENT_EXPORT extern const base::Feature kWebPayments;
CONTENT_EXPORT extern const base::Feature kWebPaymentsMinimalUI; CONTENT_EXPORT extern const base::Feature kWebPaymentsMinimalUI;
CONTENT_EXPORT extern const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames; CONTENT_EXPORT extern const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames;
......
...@@ -8049,6 +8049,22 @@ ...@@ -8049,6 +8049,22 @@
] ]
} }
], ],
"WebOtpBackendAuto": [
{
"platforms": [
"android",
"android_weblayer"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"WebOtpBackendAuto"
]
}
]
}
],
"WebProtectConnectors": [ "WebProtectConnectors": [
{ {
"platforms": [ "platforms": [
......
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