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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillAddress.java

Issue 2039863002: PaymentRequest: Sync up PaymentAddress with the payment request spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; 7 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
8 import org.chromium.chrome.browser.payments.ui.PaymentOption; 8 import org.chromium.chrome.browser.payments.ui.PaymentOption;
9 import org.chromium.mojom.payments.PaymentAddress; 9 import org.chromium.mojom.payments.PaymentAddress;
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 mProfile = profile; 51 mProfile = profile;
52 } 52 }
53 53
54 /** 54 /**
55 * Returns the shipping address for mojo. 55 * Returns the shipping address for mojo.
56 */ 56 */
57 public PaymentAddress toPaymentAddress() { 57 public PaymentAddress toPaymentAddress() {
58 PaymentAddress result = new PaymentAddress(); 58 PaymentAddress result = new PaymentAddress();
59 59
60 result.regionCode = mProfile.getCountryCode(); 60 result.country = mProfile.getCountryCode();
61 result.addressLine = mProfile.getStreetAddress().split("\n"); 61 result.addressLine = mProfile.getStreetAddress().split("\n");
62 result.administrativeArea = mProfile.getRegion(); 62 result.region = mProfile.getRegion();
63 result.locality = mProfile.getLocality(); 63 result.city = mProfile.getLocality();
64 result.dependentLocality = mProfile.getDependentLocality(); 64 result.dependentLocality = mProfile.getDependentLocality();
65 result.postalCode = mProfile.getPostalCode(); 65 result.postalCode = mProfile.getPostalCode();
66 result.sortingCode = mProfile.getSortingCode(); 66 result.sortingCode = mProfile.getSortingCode();
67 result.organization = mProfile.getCompanyName(); 67 result.organization = mProfile.getCompanyName();
68 result.recipient = mProfile.getFullName(); 68 result.recipient = mProfile.getFullName();
please use gerrit instead 2016/06/06 16:01:14 Please also add "careOf" and "phone". result.care
zino 2016/06/06 17:23:15 Done.
69 result.languageCode = ""; 69 result.languageCode = "";
70 result.scriptCode = ""; 70 result.scriptCode = "";
71 71
72 if (mProfile.getLanguageCode() == null) return result; 72 if (mProfile.getLanguageCode() == null) return result;
73 73
74 if (mLanguageScriptCodeMatcher == null) { 74 if (mLanguageScriptCodeMatcher == null) {
75 mLanguageScriptCodeMatcher = Pattern.compile(LANGUAGE_SCRIPT_CODE_PA TTERN) 75 mLanguageScriptCodeMatcher = Pattern.compile(LANGUAGE_SCRIPT_CODE_PA TTERN)
76 .matcher(mProfile.getLanguageCo de()); 76 .matcher(mProfile.getLanguageCo de());
77 } 77 }
78 78
79 if (mLanguageScriptCodeMatcher.matches()) { 79 if (mLanguageScriptCodeMatcher.matches()) {
80 String languageCode = mLanguageScriptCodeMatcher.group(LANGUAGE_CODE _GROUP); 80 String languageCode = mLanguageScriptCodeMatcher.group(LANGUAGE_CODE _GROUP);
81 result.languageCode = languageCode != null ? languageCode : ""; 81 result.languageCode = languageCode != null ? languageCode : "";
82 82
83 String scriptCode = mLanguageScriptCodeMatcher.group(SCRIPT_CODE_GRO UP); 83 String scriptCode = mLanguageScriptCodeMatcher.group(SCRIPT_CODE_GRO UP);
84 result.scriptCode = scriptCode != null ? scriptCode : ""; 84 result.scriptCode = scriptCode != null ? scriptCode : "";
85 } 85 }
86 86
87 return result; 87 return result;
88 } 88 }
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698