| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 result.addressLine = mProfile.getStreetAddress().split("\n"); | 82 result.addressLine = mProfile.getStreetAddress().split("\n"); |
| 83 result.region = mProfile.getRegion(); | 83 result.region = mProfile.getRegion(); |
| 84 result.city = mProfile.getLocality(); | 84 result.city = mProfile.getLocality(); |
| 85 result.dependentLocality = mProfile.getDependentLocality(); | 85 result.dependentLocality = mProfile.getDependentLocality(); |
| 86 result.postalCode = mProfile.getPostalCode(); | 86 result.postalCode = mProfile.getPostalCode(); |
| 87 result.sortingCode = mProfile.getSortingCode(); | 87 result.sortingCode = mProfile.getSortingCode(); |
| 88 result.organization = mProfile.getCompanyName(); | 88 result.organization = mProfile.getCompanyName(); |
| 89 result.recipient = mProfile.getFullName(); | 89 result.recipient = mProfile.getFullName(); |
| 90 result.languageCode = ""; | 90 result.languageCode = ""; |
| 91 result.scriptCode = ""; | 91 result.scriptCode = ""; |
| 92 result.careOf = ""; | |
| 93 result.phone = mProfile.getPhoneNumber(); | 92 result.phone = mProfile.getPhoneNumber(); |
| 94 | 93 |
| 95 if (mProfile.getLanguageCode() == null) return result; | 94 if (mProfile.getLanguageCode() == null) return result; |
| 96 | 95 |
| 97 if (mLanguageScriptCodePattern == null) { | 96 if (mLanguageScriptCodePattern == null) { |
| 98 mLanguageScriptCodePattern = Pattern.compile(LANGUAGE_SCRIPT_CODE_PA
TTERN); | 97 mLanguageScriptCodePattern = Pattern.compile(LANGUAGE_SCRIPT_CODE_PA
TTERN); |
| 99 } | 98 } |
| 100 | 99 |
| 101 Matcher matcher = mLanguageScriptCodePattern.matcher(mProfile.getLanguag
eCode()); | 100 Matcher matcher = mLanguageScriptCodePattern.matcher(mProfile.getLanguag
eCode()); |
| 102 if (matcher.matches()) { | 101 if (matcher.matches()) { |
| 103 result.languageCode = ensureNotNull(matcher.group(LANGUAGE_CODE_GROU
P)); | 102 result.languageCode = ensureNotNull(matcher.group(LANGUAGE_CODE_GROU
P)); |
| 104 result.scriptCode = ensureNotNull(matcher.group(SCRIPT_CODE_GROUP)); | 103 result.scriptCode = ensureNotNull(matcher.group(SCRIPT_CODE_GROUP)); |
| 105 } | 104 } |
| 106 | 105 |
| 107 return result; | 106 return result; |
| 108 } | 107 } |
| 109 | 108 |
| 110 private static String ensureNotNull(@Nullable String value) { | 109 private static String ensureNotNull(@Nullable String value) { |
| 111 return value == null ? "" : value; | 110 return value == null ? "" : value; |
| 112 } | 111 } |
| 113 } | 112 } |
| OLD | NEW |