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