| 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 44bc75d4b1ef2bfa34541677372ae808c686100a..0535e1ef4eff5b03e6adc11e9a409841bab74ea5 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
|
| @@ -271,11 +271,12 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| getMatchingPaymentInstruments();
|
|
|
| boolean requestShipping = options != null && options.requestShipping;
|
| + boolean requestPayerName = options != null && options.requestPayerName;
|
| boolean requestPayerPhone = options != null && options.requestPayerPhone;
|
| boolean requestPayerEmail = options != null && options.requestPayerEmail;
|
|
|
| List<AutofillProfile> profiles = null;
|
| - if (requestShipping || requestPayerPhone || requestPayerEmail) {
|
| + if (requestShipping || requestPayerName || requestPayerPhone || requestPayerEmail) {
|
| profiles = PersonalDataManager.getInstance().getProfilesToSuggest(
|
| false /* includeNameInLabel */);
|
| }
|
| @@ -324,30 +325,34 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| firstCompleteAddressIndex, addresses);
|
| }
|
|
|
| - if (requestPayerPhone || requestPayerEmail) {
|
| + if (requestPayerName || requestPayerPhone || requestPayerEmail) {
|
| Set<String> uniqueContactInfos = new HashSet<>();
|
| - mContactEditor = new ContactEditor(requestPayerPhone, requestPayerEmail);
|
| + mContactEditor = new ContactEditor(
|
| + requestPayerName, requestPayerPhone, requestPayerEmail);
|
| List<AutofillContact> contacts = new ArrayList<>();
|
|
|
| for (int i = 0; i < profiles.size(); i++) {
|
| AutofillProfile profile = profiles.get(i);
|
| + String name = requestPayerName && !TextUtils.isEmpty(profile.getFullName())
|
| + ? profile.getFullName() : null;
|
| String phone = requestPayerPhone && !TextUtils.isEmpty(profile.getPhoneNumber())
|
| ? profile.getPhoneNumber() : null;
|
| String email = requestPayerEmail && !TextUtils.isEmpty(profile.getEmailAddress())
|
| ? profile.getEmailAddress() : null;
|
| + mContactEditor.addPayerNameIfValid(name);
|
| mContactEditor.addPhoneNumberIfValid(phone);
|
| mContactEditor.addEmailAddressIfValid(email);
|
|
|
| - if (phone != null || email != null) {
|
| + if (name != null || phone != null || email != null) {
|
| // Different profiles can have identical contact info. Do not add the same
|
| // contact info to the list twice.
|
| - String uniqueContactInfo = phone + email;
|
| + String uniqueContactInfo = name + phone + email;
|
| if (!uniqueContactInfos.contains(uniqueContactInfo)) {
|
| uniqueContactInfos.add(uniqueContactInfo);
|
|
|
| boolean isComplete =
|
| - mContactEditor.isContactInformationComplete(phone, email);
|
| - contacts.add(new AutofillContact(profile, phone, email, isComplete));
|
| + mContactEditor.isContactInformationComplete(name, phone, email);
|
| + contacts.add(new AutofillContact(profile, name, phone, email, isComplete));
|
| }
|
| }
|
| }
|
| @@ -373,8 +378,8 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| }
|
|
|
| mUI = new PaymentRequestUI(mContext, this, requestShipping,
|
| - requestPayerPhone || requestPayerEmail, mMerchantSupportsAutofillPaymentInstruments,
|
| - mMerchantName, mOrigin);
|
| + requestPayerName || requestPayerPhone || requestPayerEmail,
|
| + mMerchantSupportsAutofillPaymentInstruments, mMerchantName, mOrigin);
|
|
|
| if (mFavicon != null) mUI.setTitleBitmap(mFavicon);
|
| mFavicon = null;
|
| @@ -1070,6 +1075,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| if (selectedContact != null) {
|
| // Contacts are created in show(). These should all be instances of AutofillContact.
|
| assert selectedContact instanceof AutofillContact;
|
| + response.payerName = ((AutofillContact) selectedContact).getPayerName();
|
| response.payerPhone = ((AutofillContact) selectedContact).getPayerPhone();
|
| response.payerEmail = ((AutofillContact) selectedContact).getPayerEmail();
|
| }
|
|
|