Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2817)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java

Issue 2482533002: [Payments] Display warning messages for incomplete shipping address and update editor title (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
index d7ff16a44713e4d462c4df3194d59371dd864443..cb319dee14ceeb2bb60e5a9019edf8c9d580106e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
@@ -144,19 +144,7 @@ public class CardEditor extends EditorBase<AutofillPaymentInstrument>
mAddressEditor = addressEditor;
mObserverForTest = observerForTest;
- List<AutofillProfile> profiles = PersonalDataManager.getInstance().getProfilesToSuggest(
- true /* includeNameInLabel */);
mProfilesForBillingAddress = new HashMap<>();
- for (int i = 0; i < profiles.size(); i++) {
- AutofillProfile profile = profiles.get(i);
- // 1) Include only local profiles, because GUIDs of server profiles change on every
- // browser restart. Server profiles are not supported as billing addresses.
- // 2) Include only complete profiles, so that user launches the editor only when
- // explicitly selecting [+ ADD ADDRESS] in the dropdown.
- if (profile.getIsLocal() && mAddressEditor.isProfileComplete(profile)) {
- mProfilesForBillingAddress.put(profile.getGUID(), profile);
- }
- }
mCardTypes = new HashMap<>();
mCardTypes.put("amex",
@@ -313,13 +301,14 @@ public class CardEditor extends EditorBase<AutofillPaymentInstrument>
}
/**
- * Adds the given billing address to the list of billing addresses. If the address is already
- * known, then updates the existing address. Should be called before opening the card editor.
+ * Adds the given billing address to the list of billing addresses, if it's complete. If the
+ * address is already known, then updates the existing address. Should be called before opening
+ * the card editor.
*
- * @param billingAddress The billing address to add or update. Should not be null. Should be
- * complete.
+ * @param billingAddress The billing address to add or update. Should not be null.
*/
- public void updateBillingAddress(AutofillAddress billingAddress) {
+ public void updateBillingAddressIfComplete(AutofillAddress billingAddress) {
+ if (!billingAddress.isComplete()) return;
mProfilesForBillingAddress.put(billingAddress.getIdentifier(), billingAddress.getProfile());
}

Powered by Google App Engine
This is Rietveld 408576698