Commit aef92d13 authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Chromium LUCI CQ

Revert "[WebLayer] Remove isServerAutofillInstrument"

This reverts commit 87d3589b.

Reason for revert: Caused downstream compile failures
https://ci.chromium.org/ui/p/chrome/builders/ci/android-internal-chromium-tot/73706/overview

Original change's description:
> [WebLayer] Remove isServerAutofillInstrument
>
> Context:
> isServerAutofillInstrument, mHideServerAutofillCards are not being used
> and so should be removed. This will make a less complicated
> BrowserPaymentRequest#notifyPaymentUiOfPendingApps because pendingApps
> is no longer filtered.
>
> Changes:
> * Removed the related code of isServerAutofillInstrument.
> * Removed the related code of mHideServerAutofillCards.
>
> Bug: 1025619
> Change-Id: I2b836226802cbaa2e464f8f1c94d59fbba4b848d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2565450
> Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
> Reviewed-by: Nick Burris <nburris@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#832352}

TBR=maxlg@chromium.org,nburris@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I8c730d589f3b4b3e11dc578708356eba651f4c36
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1025619
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567815Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832362}
parent bb59e826
......@@ -118,6 +118,11 @@ public class AutofillPaymentInstrument
return true;
}
@Override
public boolean isServerAutofillInstrument() {
return !mCard.getIsLocal();
}
@Override
public boolean isValidForPaymentMethodData(String method, PaymentMethodData data) {
boolean isSupportedMethod = super.isValidForPaymentMethodData(method, data);
......
......@@ -52,6 +52,7 @@ import org.chromium.payments.mojom.PaymentResponse;
import org.chromium.payments.mojom.PaymentValidationErrors;
import org.chromium.url.GURL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
......@@ -80,6 +81,7 @@ public class ChromePaymentRequestService
private boolean mHasClosed;
private PaymentRequestSpec mSpec;
private boolean mHideServerAutofillCards;
private PaymentHandlerHost mPaymentHandlerHost;
/**
......@@ -579,12 +581,24 @@ public class ChromePaymentRequestService
// Implements BrowserPaymentRequest:
@Override
public void onPaymentAppCreated(PaymentApp paymentApp) {
mHideServerAutofillCards |= paymentApp.isServerAutofillInstrumentReplacement();
paymentApp.setHaveRequestedAutofillData(mPaymentUiService.haveRequestedAutofillData());
}
// Implements BrowserPaymentRequest:
@Override
public void notifyPaymentUiOfPendingApps(List<PaymentApp> pendingApps) {
if (mHideServerAutofillCards) {
List<PaymentApp> nonServerAutofillCards = new ArrayList<>();
int numberOfPendingApps = pendingApps.size();
for (int i = 0; i < numberOfPendingApps; i++) {
if (!pendingApps.get(i).isServerAutofillInstrument()) {
nonServerAutofillCards.add(pendingApps.get(i));
}
}
pendingApps = nonServerAutofillCards;
}
// Load the validation rules for each unique region code in the credit card billing
// addresses and check for validity.
Set<String> uniqueCountryCodes = new HashSet<>();
......
......@@ -106,6 +106,20 @@ public abstract class PaymentApp extends EditableOption {
return false;
}
/** @return Whether this is a server autofill app. */
public boolean isServerAutofillInstrument() {
return false;
}
/**
* @return Whether this is a replacement for all server autofill apps. If at least one of
* the displayed apps returns true here, then all apps that return true in
* isServerAutofillInstrument() should be hidden.
*/
public boolean isServerAutofillInstrumentReplacement() {
return false;
}
/**
* @return Whether the app supports the payment method with the method data. For example,
* supported card types and networks in the data should be verified for 'basic-card'
......
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