Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| index d3a9a9fa328021c0c9495814aa9a1fc2c365dda5..34a30604d681c63aeca8737a2efbe16ef21c1b62 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| @@ -281,24 +281,27 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie |
| boolean requestPayerPhone = options != null && options.requestPayerPhone; |
| boolean requestPayerEmail = options != null && options.requestPayerEmail; |
| - List<AutofillProfile> profiles = null; |
| - if (requestShipping || requestPayerName || requestPayerPhone || requestPayerEmail) { |
| - profiles = PersonalDataManager.getInstance().getProfilesToSuggest( |
| - false /* includeNameInLabel */); |
| + List<AutofillProfile> profiles = PersonalDataManager.getInstance().getProfilesToSuggest( |
| + false /* includeNameInLabel */); |
| + |
| + List<AutofillAddress> addresses = new ArrayList<>(); |
| + for (int i = 0; i < profiles.size(); i++) { |
| + AutofillProfile profile = profiles.get(i); |
| + |
| + // Only use addresses that have a street address. |
| + if (TextUtils.isEmpty(profile.getStreetAddress())) continue; |
| + addresses.add(new AutofillAddress(mContext, profile)); |
| } |
| - if (requestShipping) { |
| - List<AutofillAddress> addresses = new ArrayList<>(); |
| + // Update complete addresses to card editor. |
| + for (int i = 0; i < addresses.size(); i++) { |
| + mCardEditor.updateBillingAddressIfComplete(addresses.get(i)); |
|
please use gerrit instead
2016/11/07 22:41:28
Can't re-use the same address for billing and ship
gogerald1
2016/11/08 20:50:17
Done.
|
| + } |
| + if (requestShipping) { |
| + // Add all valid phone numbers to address editor. |
| for (int i = 0; i < profiles.size(); i++) { |
| - AutofillProfile profile = profiles.get(i); |
| - mAddressEditor.addPhoneNumberIfValid(profile.getPhoneNumber()); |
| - |
| - // Only suggest addresses that have a street address. |
| - if (!TextUtils.isEmpty(profile.getStreetAddress())) { |
| - boolean isComplete = mAddressEditor.isProfileComplete(profile); |
| - addresses.add(new AutofillAddress(profile, isComplete)); |
| - } |
| + mAddressEditor.addPhoneNumberIfValid(profiles.get(i).getPhoneNumber()); |
| } |
| // Suggest complete addresses first. |
| @@ -786,7 +789,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie |
| providePaymentInformation(); |
| } else { |
| if (toEdit == null) mShippingAddressesSection.addAndSelectItem(completeAddress); |
| - mCardEditor.updateBillingAddress(completeAddress); |
| + mCardEditor.updateBillingAddressIfComplete(completeAddress); |
| mClient.onShippingAddressChange(completeAddress.toPaymentAddress()); |
| } |
| } |