| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.chrome.browser.autofill; | |
| 6 | |
| 7 import org.chromium.base.VisibleForTesting; | |
| 8 import org.chromium.base.annotations.CalledByNative; | |
| 9 import org.chromium.base.annotations.JNINamespace; | |
| 10 | |
| 11 /** | |
| 12 * Java-side result of a non-cancelled AutofillDialog invocation, and | |
| 13 * JNI glue for C++ AutofillDialogResult used by AutofillDialogControllerAndroid
. | |
| 14 */ | |
| 15 @JNINamespace("autofill") | |
| 16 public class AutofillDialogResult { | |
| 17 /** | |
| 18 * Information about the credit card in the dialog result. | |
| 19 */ | |
| 20 public static class ResultCard { | |
| 21 private final int mExpirationMonth; | |
| 22 private final int mExpirationYear; | |
| 23 private final String mPan; | |
| 24 private final String mCvn; | |
| 25 | |
| 26 /** | |
| 27 * Creates a ResultCard. | |
| 28 * @param expirationMonth Expiration month | |
| 29 * @param expirationYear Expiration year | |
| 30 * @param pan Credit card number | |
| 31 * @param cvn Credit card verification number | |
| 32 */ | |
| 33 @VisibleForTesting | |
| 34 public ResultCard(int expirationMonth, int expirationYear, String pan, S
tring cvn) { | |
| 35 mExpirationMonth = expirationMonth; | |
| 36 mExpirationYear = expirationYear; | |
| 37 mPan = pan; | |
| 38 mCvn = cvn; | |
| 39 } | |
| 40 | |
| 41 /** | |
| 42 * @return Expiration month | |
| 43 */ | |
| 44 @CalledByNative("ResultCard") | |
| 45 public int getExpirationMonth() { | |
| 46 return mExpirationMonth; | |
| 47 } | |
| 48 | |
| 49 /** | |
| 50 * @return Expiration year | |
| 51 */ | |
| 52 @CalledByNative("ResultCard") | |
| 53 public int getExpirationYear() { | |
| 54 return mExpirationYear; | |
| 55 } | |
| 56 | |
| 57 /** | |
| 58 * @return Credit card number | |
| 59 */ | |
| 60 @CalledByNative("ResultCard") | |
| 61 public String getPan() { | |
| 62 return mPan; | |
| 63 } | |
| 64 | |
| 65 /** | |
| 66 * @return Credit card verification number | |
| 67 */ | |
| 68 @CalledByNative("ResultCard") | |
| 69 public String getCvn() { | |
| 70 return mCvn; | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 /** | |
| 75 * Information about an address in the dialog result. | |
| 76 */ | |
| 77 public static class ResultAddress { | |
| 78 private final String mName; | |
| 79 private final String mPhoneNumber; | |
| 80 private final String mStreetAddress; | |
| 81 private final String mLocality; | |
| 82 private final String mDependentLocality; | |
| 83 private final String mAdministrativeArea; | |
| 84 private final String mPostalCode; | |
| 85 private final String mSortingCode; | |
| 86 private final String mCountryCode; | |
| 87 private final String mLanguageCode; | |
| 88 | |
| 89 /** | |
| 90 * Creates a ResultAddress. | |
| 91 * Any parameter can be empty or null. | |
| 92 * @param name Full name | |
| 93 * @param phoneNumber Phone number | |
| 94 * @param streetAddress Street address | |
| 95 * @param locality Locality / City | |
| 96 * @param dependentLocality Inner-city district / Suburb / Dependent loc
ality | |
| 97 * @param administrativeArea Region / State | |
| 98 * @param postalCode Postal code | |
| 99 * @param sortingCode Sorting code | |
| 100 * @param countryCode Country code | |
| 101 * @param languageCode Language code | |
| 102 */ | |
| 103 @VisibleForTesting | |
| 104 public ResultAddress( | |
| 105 String name, String phoneNumber, | |
| 106 String streetAddress, | |
| 107 String locality, String dependentLocality, | |
| 108 String administrativeArea, String postalCode, String sortingCode
, | |
| 109 String countryCode, String languageCode) { | |
| 110 mName = name; | |
| 111 mPhoneNumber = phoneNumber; | |
| 112 mStreetAddress = streetAddress; | |
| 113 mLocality = locality; | |
| 114 mDependentLocality = dependentLocality; | |
| 115 mAdministrativeArea = administrativeArea; | |
| 116 mPostalCode = postalCode; | |
| 117 mSortingCode = sortingCode; | |
| 118 mCountryCode = countryCode; | |
| 119 mLanguageCode = languageCode; | |
| 120 } | |
| 121 | |
| 122 /** | |
| 123 * @return Full name | |
| 124 */ | |
| 125 @CalledByNative("ResultAddress") | |
| 126 public String getName() { | |
| 127 return mName; | |
| 128 } | |
| 129 | |
| 130 /** | |
| 131 * @return Phone number | |
| 132 */ | |
| 133 @CalledByNative("ResultAddress") | |
| 134 public String getPhoneNumber() { | |
| 135 return mPhoneNumber; | |
| 136 } | |
| 137 | |
| 138 /** | |
| 139 * @return Street address | |
| 140 */ | |
| 141 @CalledByNative("ResultAddress") | |
| 142 public String getStreetAddress() { | |
| 143 return mStreetAddress; | |
| 144 } | |
| 145 | |
| 146 /** | |
| 147 * @return Locality (city) | |
| 148 */ | |
| 149 @CalledByNative("ResultAddress") | |
| 150 public String getLocality() { | |
| 151 return mLocality; | |
| 152 } | |
| 153 | |
| 154 /** | |
| 155 * @return Dependent locality (inner-city district / suburb) | |
| 156 */ | |
| 157 @CalledByNative("ResultAddress") | |
| 158 public String getDependentLocality() { | |
| 159 return mDependentLocality; | |
| 160 } | |
| 161 | |
| 162 /** | |
| 163 * @return Administrative area (region / state) | |
| 164 */ | |
| 165 @CalledByNative("ResultAddress") | |
| 166 public String getAdministrativeArea() { | |
| 167 return mAdministrativeArea; | |
| 168 } | |
| 169 | |
| 170 /** | |
| 171 * @return Postal code | |
| 172 */ | |
| 173 @CalledByNative("ResultAddress") | |
| 174 public String getPostalCode() { | |
| 175 return mPostalCode; | |
| 176 } | |
| 177 | |
| 178 /** | |
| 179 * @return Sorting code | |
| 180 */ | |
| 181 @CalledByNative("ResultAddress") | |
| 182 public String getSortingCode() { | |
| 183 return mSortingCode; | |
| 184 } | |
| 185 | |
| 186 /** | |
| 187 * @return Country code | |
| 188 */ | |
| 189 @CalledByNative("ResultAddress") | |
| 190 public String getCountryCode() { | |
| 191 return mCountryCode; | |
| 192 } | |
| 193 | |
| 194 /** | |
| 195 * @return Language code | |
| 196 */ | |
| 197 @CalledByNative("ResultAddress") | |
| 198 public String getLanguageCode() { | |
| 199 return mLanguageCode; | |
| 200 } | |
| 201 } | |
| 202 | |
| 203 /** | |
| 204 * A response from the dialog. | |
| 205 */ | |
| 206 public static class ResultWallet { | |
| 207 private final String mEmail; | |
| 208 private final String mGoogleTransactionId; | |
| 209 private final ResultCard mCard; | |
| 210 private final ResultAddress mBillingAddress; | |
| 211 private final ResultAddress mShippingAddress; | |
| 212 | |
| 213 /** | |
| 214 * Creates a ResultWallet. | |
| 215 * Any fields could be empty or null. | |
| 216 * @param email Email address | |
| 217 * @param googleTransactionId Google transaction ID if any | |
| 218 * @param card Information about the credit card | |
| 219 * @param billingAddress Information about the billing address | |
| 220 * @param shippingAddress Information about the shipping address | |
| 221 */ | |
| 222 @VisibleForTesting | |
| 223 public ResultWallet( | |
| 224 String email, String googleTransactionId, | |
| 225 ResultCard card, ResultAddress billingAddress, ResultAddress shi
ppingAddress) { | |
| 226 mEmail = email; | |
| 227 mGoogleTransactionId = googleTransactionId; | |
| 228 mCard = card; | |
| 229 mBillingAddress = billingAddress; | |
| 230 mShippingAddress = shippingAddress; | |
| 231 } | |
| 232 | |
| 233 /** | |
| 234 * @return Email address | |
| 235 */ | |
| 236 @CalledByNative("ResultWallet") | |
| 237 public String getEmail() { | |
| 238 return mEmail; | |
| 239 } | |
| 240 | |
| 241 /** | |
| 242 * @return Google transaction ID if any | |
| 243 */ | |
| 244 @CalledByNative("ResultWallet") | |
| 245 public String getGoogleTransactionId() { | |
| 246 return mGoogleTransactionId; | |
| 247 } | |
| 248 | |
| 249 /** | |
| 250 * @return Credit card information, or null | |
| 251 */ | |
| 252 @CalledByNative("ResultWallet") | |
| 253 public ResultCard getCard() { | |
| 254 return mCard; | |
| 255 } | |
| 256 | |
| 257 /** | |
| 258 * @return Billing address information, or null | |
| 259 */ | |
| 260 @CalledByNative("ResultWallet") | |
| 261 public ResultAddress getBillingAddress() { | |
| 262 return mBillingAddress; | |
| 263 } | |
| 264 | |
| 265 /** | |
| 266 * @return Shipping address information, or null | |
| 267 */ | |
| 268 @CalledByNative("ResultWallet") | |
| 269 public ResultAddress getShippingAddress() { | |
| 270 return mShippingAddress; | |
| 271 } | |
| 272 } | |
| 273 } | |
| OLD | NEW |