| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PayerInfoEditor.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PayerInfoEditor.java
|
| similarity index 80%
|
| rename from chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java
|
| rename to chrome/android/java/src/org/chromium/chrome/browser/payments/PayerInfoEditor.java
|
| index bade26fc6d6b632a2d9da00cf70c9e8ae21ca15c..122b9d5430affd3bf19e1efea48b6046f8a007aa 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PayerInfoEditor.java
|
| @@ -21,9 +21,9 @@ import java.util.Set;
|
| import javax.annotation.Nullable;
|
|
|
| /**
|
| - * Contact information editor.
|
| + * Payer information editor.
|
| */
|
| -public class ContactEditor extends EditorBase<AutofillContact> {
|
| +public class PayerInfoEditor extends EditorBase<AutofillPayerInfo> {
|
| private final boolean mRequestPayerPhone;
|
| private final boolean mRequestPayerEmail;
|
| private final Set<CharSequence> mPhoneNumbers;
|
| @@ -32,12 +32,12 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
| @Nullable private EditorFieldValidator mEmailValidator;
|
|
|
| /**
|
| - * Builds a contact information editor.
|
| + * Builds a payer information editor.
|
| *
|
| * @param requestPayerPhone Whether to request the user's phone number.
|
| * @param requestPayerEmail Whether to request the user's email address.
|
| */
|
| - public ContactEditor(boolean requestPayerPhone, boolean requestPayerEmail) {
|
| + public PayerInfoEditor(boolean requestPayerPhone, boolean requestPayerEmail) {
|
| assert requestPayerPhone || requestPayerEmail;
|
| mRequestPayerPhone = requestPayerPhone;
|
| mRequestPayerEmail = requestPayerEmail;
|
| @@ -46,14 +46,14 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
| }
|
|
|
| /**
|
| - * Returns whether the following contact information can be sent to the merchant as-is without
|
| + * Returns whether the following payer information can be sent to the merchant as-is without
|
| * editing first.
|
| *
|
| * @param phone The phone number to check.
|
| * @param email The email address to check.
|
| - * @return Whether the contact information is complete.
|
| + * @return Whether the payer information is complete.
|
| */
|
| - public boolean isContactInformationComplete(@Nullable String phone, @Nullable String email) {
|
| + public boolean isPayerInformationComplete(@Nullable String phone, @Nullable String email) {
|
| return (!mRequestPayerPhone || getPhoneValidator().isValid(phone))
|
| && (!mRequestPayerEmail || getEmailValidator().isValid(email));
|
| }
|
| @@ -77,11 +77,12 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
| }
|
|
|
| @Override
|
| - public void edit(@Nullable AutofillContact toEdit, final Callback<AutofillContact> callback) {
|
| + public void edit(
|
| + @Nullable AutofillPayerInfo toEdit, final Callback<AutofillPayerInfo> callback) {
|
| super.edit(toEdit, callback);
|
|
|
| - final AutofillContact contact = toEdit == null
|
| - ? new AutofillContact(new AutofillProfile(), null, null, false) : toEdit;
|
| + final AutofillPayerInfo payerInfo = toEdit == null
|
| + ? new AutofillPayerInfo(new AutofillProfile(), null, null, false) : toEdit;
|
|
|
| final EditorFieldModel phoneField = mRequestPayerPhone
|
| ? EditorFieldModel.createTextInput(EditorFieldModel.INPUT_TYPE_HINT_PHONE,
|
| @@ -89,7 +90,7 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
| mPhoneNumbers, getPhoneValidator(),
|
| mContext.getString(R.string.payments_field_required_validation_message),
|
| mContext.getString(R.string.payments_phone_invalid_validation_message),
|
| - contact.getPayerPhone())
|
| + payerInfo.getPayerPhone())
|
| : null;
|
|
|
| final EditorFieldModel emailField = mRequestPayerEmail
|
| @@ -98,12 +99,12 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
| mEmailAddresses, getEmailValidator(),
|
| mContext.getString(R.string.payments_field_required_validation_message),
|
| mContext.getString(R.string.payments_email_invalid_validation_message),
|
| - contact.getPayerEmail())
|
| + payerInfo.getPayerEmail())
|
| : null;
|
|
|
| - EditorModel editor = new EditorModel(
|
| - mContext.getString(toEdit == null ? R.string.payments_add_contact_details_label
|
| - : R.string.payments_edit_contact_details_label));
|
| + EditorModel editor = new EditorModel(mContext.getString(toEdit == null
|
| + ? R.string.payments_add_payer_info_details_label
|
| + : R.string.payments_edit_payer_info_details_label));
|
| if (phoneField != null) editor.addField(phoneField);
|
| if (emailField != null) editor.addField(emailField);
|
|
|
| @@ -122,17 +123,17 @@ public class ContactEditor extends EditorBase<AutofillContact> {
|
|
|
| if (phoneField != null) {
|
| phone = phoneField.getValue().toString();
|
| - contact.getProfile().setPhoneNumber(phone);
|
| + payerInfo.getProfile().setPhoneNumber(phone);
|
| }
|
|
|
| if (emailField != null) {
|
| email = emailField.getValue().toString();
|
| - contact.getProfile().setEmailAddress(email);
|
| + payerInfo.getProfile().setEmailAddress(email);
|
| }
|
|
|
| - String guid = PersonalDataManager.getInstance().setProfile(contact.getProfile());
|
| - contact.completeContact(guid, phone, email);
|
| - callback.onResult(contact);
|
| + String guid = PersonalDataManager.getInstance().setProfile(payerInfo.getProfile());
|
| + payerInfo.completePayerInfo(guid, phone, email);
|
| + callback.onResult(payerInfo);
|
| }
|
| });
|
|
|
|
|