OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.text.TextUtils; | 7 import android.text.TextUtils; |
8 | 8 |
9 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
10 import org.chromium.chrome.browser.payments.ui.PaymentOption; | 10 import org.chromium.chrome.browser.payments.ui.PaymentOption; |
(...skipping 12 matching lines...) Expand all Loading... |
23 * Builds contact details. | 23 * Builds contact details. |
24 * | 24 * |
25 * @param profile The autofill profile where this contact data lives. | 25 * @param profile The autofill profile where this contact data lives. |
26 * @param phone The phone number. If not empty, this will be the primar
y label. | 26 * @param phone The phone number. If not empty, this will be the primar
y label. |
27 * @param email The email address. If phone is empty, this will be the
primary label. | 27 * @param email The email address. If phone is empty, this will be the
primary label. |
28 * @param isComplete Whether the data in this contact can be sent to the mer
chant as-is. If | 28 * @param isComplete Whether the data in this contact can be sent to the mer
chant as-is. If |
29 * false, user needs to add more information here. | 29 * false, user needs to add more information here. |
30 */ | 30 */ |
31 public AutofillContact(AutofillProfile profile, @Nullable String phone, @Nul
lable String email, | 31 public AutofillContact(AutofillProfile profile, @Nullable String phone, @Nul
lable String email, |
32 boolean isComplete) { | 32 boolean isComplete) { |
33 super(profile.getGUID(), null, null, PaymentOption.NO_ICON); | 33 super(profile.getGUID(), null, null, null); |
34 mProfile = profile; | 34 mProfile = profile; |
35 mIsComplete = isComplete; | 35 mIsComplete = isComplete; |
36 setGuidPhoneEmail(profile.getGUID(), phone, email); | 36 setGuidPhoneEmail(profile.getGUID(), phone, email); |
37 } | 37 } |
38 | 38 |
39 /** @return Email address. Null if the merchant did not request it or data i
s incomplete. */ | 39 /** @return Email address. Null if the merchant did not request it or data i
s incomplete. */ |
40 @Nullable public String getPayerEmail() { | 40 @Nullable public String getPayerEmail() { |
41 return mPayerEmail; | 41 return mPayerEmail; |
42 } | 42 } |
43 | 43 |
(...skipping 21 matching lines...) Expand all Loading... |
65 setGuidPhoneEmail(guid, phone, email); | 65 setGuidPhoneEmail(guid, phone, email); |
66 } | 66 } |
67 | 67 |
68 private void setGuidPhoneEmail(String guid, @Nullable String phone, @Nullabl
e String email) { | 68 private void setGuidPhoneEmail(String guid, @Nullable String phone, @Nullabl
e String email) { |
69 mPayerPhone = TextUtils.isEmpty(phone) ? null : phone; | 69 mPayerPhone = TextUtils.isEmpty(phone) ? null : phone; |
70 mPayerEmail = TextUtils.isEmpty(email) ? null : email; | 70 mPayerEmail = TextUtils.isEmpty(email) ? null : email; |
71 updateIdentifierAndLabels(guid, mPayerPhone == null ? mPayerEmail : mPay
erPhone, | 71 updateIdentifierAndLabels(guid, mPayerPhone == null ? mPayerEmail : mPay
erPhone, |
72 mPayerPhone == null ? null : mPayerEmail); | 72 mPayerPhone == null ? null : mPayerEmail); |
73 } | 73 } |
74 } | 74 } |
OLD | NEW |