Commit 253ad44a authored by Majid Valipour's avatar Majid Valipour Committed by Commit Bot

[WebOTP] Better default consent handler for Auto backend

Previously when using the Auto backend no user prompt would be shown.
This patch changes this logic to treat the Auto backend the same as the
verification backend.

Note that the Auto backend may use either of the GMS APIs which may or
may not require the user prompt. A follow up patch [1] changes the
prompt decision to be made per otp request and based on the actual API
used instead of once based on the switch value.

However treating the Auto similar to the Verification makes sense as a
quick fix since Auto is most likely to use the Verification method
anyway for the vast majority of cases.

Worst case if the other backend is used we show two prompts (one
native, one chrome) which is still better than no prompt.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2530272

Bug: 1141024
Change-Id: I64ada09187281f99fe97770d7cfcaca8f5867adc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532874
Commit-Queue: Majid Valipour <majidvp@chromium.org>
Reviewed-by: default avatarMajid Valipour <majidvp@chromium.org>
Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826500}
parent 954dc16f
......@@ -56,9 +56,11 @@ WebOTPService::WebOTPService(
host->GetLastCommittedOrigin(),
host,
std::move(receiver)) {
auto otp_switch = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend);
bool needs_user_prompt =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend) == switches::kWebOtpBackendSmsVerification;
otp_switch == switches::kWebOtpBackendSmsVerification ||
otp_switch == switches::kWebOtpBackendAuto;
if (needs_user_prompt) {
consent_handler_ = std::make_unique<PromptBasedUserConsentHandler>(
......
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