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 06c9313bca9f80a42c04448c8d32cd2e98f28f86..7f4d041775652643075ea9837e6906c96000498d 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 /* includeName */); |
please use gerrit instead
2016/10/13 20:20:33
s/includeName/includeNameInLabel/g
It's confusing
zino
2016/10/14 19:01:56
I agree with you. I thought it was confusing!
I up
|
} |
@@ -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(); |
} |