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

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

Issue 2681803005: [Payments] Prefill card holder name as the new billing address name (Closed)
Patch Set: address comment Created 3 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9b76320a94726e5144505e4368182c49053d825b..4413a88e937345a60eefe6bdef205bb0cf2b574c 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
@@ -675,15 +675,21 @@ public class CardEditor extends EditorBase<AutofillPaymentInstrument>
}
return;
}
-
- final AutofillAddress editAddress = isSelectingIncompleteAddress
- ? new AutofillAddress(mContext,
- findTargetProfile(mProfilesForBillingAddress, eventData.first))
- : null;
+ assert isAddingNewAddress || isSelectingIncompleteAddress;
+
+ AutofillProfile profile = isSelectingIncompleteAddress
+ ? findTargetProfile(mProfilesForBillingAddress, eventData.first)
+ : new AutofillProfile();
+ if (TextUtils.isEmpty(profile.getFullName())) {
+ // Prefill card holder name as the billing address name.
+ profile.setFullName(
+ card.getIsLocal() ? mNameField.getValue().toString() : card.getName());
+ }
+ final AutofillAddress editAddress = new AutofillAddress(mContext, profile);
mAddressEditor.edit(editAddress, new Callback<AutofillAddress>() {
@Override
public void onResult(AutofillAddress billingAddress) {
- if (billingAddress == null || !billingAddress.isComplete()) {
+ if (!billingAddress.isComplete()) {
// User cancelled out of the add or edit flow. Restore the selection
// to the card's billing address, if any, else clear the selection.
if (mBillingAddressField.getDropdownKeys().contains(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698