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

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

Issue 2120973002: [Payments] Show complete profiles first and limit to 4 suggestions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the null return value Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 14 matching lines...) Expand all
25 25
26 // Language/script code pattern and capture group numbers. 26 // Language/script code pattern and capture group numbers.
27 private static final String LANGUAGE_SCRIPT_CODE_PATTERN = 27 private static final String LANGUAGE_SCRIPT_CODE_PATTERN =
28 "^([a-z]{2})(-([A-Z][a-z]{3}))?(-[A-Za-z]+)*$"; 28 "^([a-z]{2})(-([A-Z][a-z]{3}))?(-[A-Za-z]+)*$";
29 private static final int LANGUAGE_CODE_GROUP = 1; 29 private static final int LANGUAGE_CODE_GROUP = 1;
30 private static final int SCRIPT_CODE_GROUP = 3; 30 private static final int SCRIPT_CODE_GROUP = 3;
31 31
32 @Nullable private static Pattern sRegionCodePattern; 32 @Nullable private static Pattern sRegionCodePattern;
33 33
34 private AutofillProfile mProfile; 34 private AutofillProfile mProfile;
35 private boolean mIsComplete;
36 @Nullable private Pattern mLanguageScriptCodePattern; 35 @Nullable private Pattern mLanguageScriptCodePattern;
37 36
38 /** 37 /**
39 * Builds the autofill address. 38 * Builds the autofill address.
40 * 39 *
41 * @param profile The autofill profile containing the address information. 40 * @param profile The autofill profile containing the address information.
42 */ 41 */
43 public AutofillAddress(AutofillProfile profile, boolean isComplete) { 42 public AutofillAddress(AutofillProfile profile, boolean isComplete) {
44 super(profile.getGUID(), profile.getFullName(), profile.getLabel(), Paym entOption.NO_ICON); 43 super(profile.getGUID(), profile.getFullName(), profile.getLabel(), Paym entOption.NO_ICON);
45 mProfile = profile; 44 mProfile = profile;
46 mIsComplete = isComplete; 45 mIsComplete = isComplete;
47 } 46 }
48 47
49 /** @return Whether the data is complete and can be sent to the merchant as- is. */
50 public boolean isComplete() {
51 return mIsComplete;
52 }
53
54 /** @return The autofill profile where this address data lives. */ 48 /** @return The autofill profile where this address data lives. */
55 public AutofillProfile getProfile() { 49 public AutofillProfile getProfile() {
56 return mProfile; 50 return mProfile;
57 } 51 }
58 52
59 /** 53 /**
60 * Updates the address and marks it "complete." Called after the user has ed ited this address. 54 * Updates the address and marks it "complete." Called after the user has ed ited this address.
61 * Updates the label and sublabel. 55 * Updates the label and sublabel.
62 * 56 *
63 * @param profile The new profile to use. The GUID should not change. 57 * @param profile The new profile to use. The GUID should not change.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 result.scriptCode = ensureNotNull(matcher.group(SCRIPT_CODE_GROUP)); 103 result.scriptCode = ensureNotNull(matcher.group(SCRIPT_CODE_GROUP));
110 } 104 }
111 105
112 return result; 106 return result;
113 } 107 }
114 108
115 private static String ensureNotNull(@Nullable String value) { 109 private static String ensureNotNull(@Nullable String value) {
116 return value == null ? "" : value; 110 return value == null ? "" : value;
117 } 111 }
118 } 112 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698