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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogResult.java

Issue 22566004: [rAc Android dialog] Stubs for Autofill dialog integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogResult.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogResult.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogResult.java
new file mode 100644
index 0000000000000000000000000000000000000000..57d5dccced1932e7caad012c65a05689e065562f
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogResult.java
@@ -0,0 +1,321 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.autofill;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+
Ted C 2013/08/10 01:33:35 remove one here too
aruslan 2013/08/10 03:00:08 Done.
+/**
+ * Java-side result of a non-cancelled AutofillDialog invocation, and
+ * JNI glue for C++ AutofillDialogResult used by AutofillDialogControllerAndroid.
+ */
+@JNINamespace("autofill")
+public class AutofillDialogResult {
+ /**
+ * Information about the credit card in the dialog result.
+ */
+ public static class ResultCard {
+ private final int mExpirationMonth;
Ted C 2013/08/10 01:33:35 if you want, as long as these are all final, you c
aruslan 2013/08/10 03:00:08 As discussed, kept these private, but made the get
+ private final int mExpirationYear;
+ private final String mPan;
+ private final String mCvn;
+
+ /**
+ * Creates a ResultCard.
+ * @param expirationMonth Expiration month
+ * @param expirationYear Expiration year
+ * @param pan Credit card number
+ * @param cvn Credit card verification number
+ */
+ public ResultCard(int expirationMonth, int expirationYear, String pan, String cvn) {
+ mExpirationMonth = expirationMonth;
+ mExpirationYear = expirationYear;
+ mPan = pan;
+ mCvn = cvn;
+ }
+
+ /**
+ * @return Expiration month
+ */
+ public int getExpirationMonth() {
+ return mExpirationMonth;
+ }
+
+ /**
+ * @return Expiration year
+ */
+ public int getExpirationYear() {
+ return mExpirationYear;
+ }
+
+ /**
+ * @return Credit card number
+ */
+ public String getPan() {
+ return mPan;
+ }
+
+ /**
+ * @return Credit card verification number
+ */
+ public String getCvn() {
+ return mCvn;
+ }
+ }
+
+ /**
+ * Information about an address in the dialog result.
+ */
+ public static class ResultAddress {
+ private final String mName;
+ private final String mPhoneNumber;
+ private final String mAddress1;
+ private final String mAddress2;
+ private final String mCity;
+ private final String mState;
+ private final String mPostalCode;
+ private final String mCountryCode;
+
+ /**
+ * Creates a ResultAddress.
+ * Any parameter can be empty or null.
+ * @param name Full name
+ * @param phoneNumber Phone number
+ * @param address1 Address line 1
+ * @param address2 Address line 2
+ * @param city City
+ * @param state State
+ * @param postalCode Postal code
+ * @param countryCode Country code
+ */
+ public ResultAddress(
+ String name, String phoneNumber,
+ String address1, String address2,
+ String city, String state, String postalCode,
+ String countryCode) {
+ mName = name;
+ mPhoneNumber = phoneNumber;
+ mAddress1 = address1;
+ mAddress2 = address2;
+ mCity = city;
+ mState = state;
+ mPostalCode = postalCode;
+ mCountryCode = countryCode;
+ }
+
+ /**
+ * @return Full name
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
+ * @return Phone number
+ */
+ public String getPhoneNumber() {
+ return mPhoneNumber;
+ }
+
+ /**
+ * @return Address line 1
+ */
+ public String getAddress1() {
+ return mAddress1;
+ }
+
+ /**
+ * @return Address line 2
+ */
+ public String getAddress2() {
+ return mAddress2;
+ }
+
+ /**
+ * @return City
+ */
+ public String getCity() {
+ return mCity;
+ }
+
+ /**
+ * @return State
+ */
+ public String getState() {
+ return mState;
+ }
+
+ /**
+ * @return Postal code
+ */
+ public String getPostalCode() {
+ return mPostalCode;
+ }
+
+ /**
+ * @return Country code
+ */
+ public String getCountryCode() {
+ return mCountryCode;
+ }
+ }
+
+ /**
+ * A response from the dialog.
+ */
+ public static class ResultWallet {
+ private final String mEmail;
+ private final String mGoogleTransactionId;
+ private final ResultCard mCard;
+ private final ResultAddress mBillingAddress;
+ private final ResultAddress mShippingAddress;
+
+ /**
+ * Creates a ResultWallet.
+ * Any fields could be empty or null.
+ * @param email Email address
+ * @param googleTransactionId Google transaction ID if any
+ * @param card Information about the credit card
+ * @param billingAddress Information about the billing address
+ * @param shippingAddress Information about the shipping address
+ */
+ public ResultWallet(
+ String email, String googleTransactionId,
+ ResultCard card, ResultAddress billingAddress, ResultAddress shippingAddress) {
+ mEmail = email;
+ mGoogleTransactionId = googleTransactionId;
+ mCard = card;
+ mBillingAddress = billingAddress;
+ mShippingAddress = shippingAddress;
+ }
+
+ /**
+ * @return Email address
+ */
+ public String getEmail() {
+ return mEmail;
+ }
+
+ /**
+ * @return Google transaction ID if any
+ */
+ public String getGoogleTransactionId() {
+ return mGoogleTransactionId;
+ }
+
+ /**
+ * @return Credit card information, or null
+ */
+ public ResultCard getCard() {
+ return mCard;
+ }
+
+ /**
+ * @return Billing address information, or null
+ */
+ public ResultAddress getBillingAddress() {
+ return mBillingAddress;
+ }
+
+ /**
+ * @return Shipping address information, or null
+ */
+ public ResultAddress getShippingAddress() {
+ return mShippingAddress;
+ }
+ }
+
+ // JNI ResultWallet:
+
+ @CalledByNative
+ private static String getWalletEmail(Object fullWallet) {
Ted C 2013/08/10 01:33:35 I think these can be ResultWallet instead Object,
aruslan 2013/08/10 03:00:08 Dropped the statics entirely.
+ return((ResultWallet) fullWallet).getEmail();
Ted C 2013/08/10 01:33:35 space after return
aruslan 2013/08/10 03:00:08 Done.
+ }
+
+ @CalledByNative
+ private static String getWalletGoogleTransactionId(Object fullWallet) {
+ return ((ResultWallet) fullWallet).getGoogleTransactionId();
+ }
+
+ @CalledByNative
+ private static Object getWalletBillingAddress(Object fullWallet) {
+ return ((ResultWallet) fullWallet).getBillingAddress();
+ }
+
+ @CalledByNative
+ private static Object getWalletShippingAddress(Object fullWallet) {
+ return ((ResultWallet) fullWallet).getShippingAddress();
+ }
+
+ @CalledByNative
+ private static Object getWalletCardInformation(Object fullWallet) {
+ return ((ResultWallet) fullWallet).getCard();
+ }
+
+ // JNI ResultAddress:
+
+ @CalledByNative
+ private static String getWalletAddressLine1(Object address) {
+ return ((ResultAddress) address).getAddress1();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressLine2(Object address) {
+ return ((ResultAddress) address).getAddress2();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressCity(Object address) {
+ return ((ResultAddress) address).getCity();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressState(Object address) {
+ return ((ResultAddress) address).getState();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressPostalCode(Object address) {
+ return ((ResultAddress) address).getPostalCode();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressCountryCode(Object address) {
+ return ((ResultAddress) address).getCountryCode();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressPhoneNumber(Object address) {
+ return ((ResultAddress) address).getPhoneNumber();
+ }
+
+ @CalledByNative
+ private static String getWalletAddressFullName(Object address) {
+ return ((ResultAddress) address).getName();
+ }
+
+ // JNI ResultCard:
+
+ @CalledByNative
+ private static int getWalletCardExpirationMonth(Object card) {
+ return ((ResultCard) card).getExpirationMonth();
+ }
+
+ @CalledByNative
+ private static int getWalletCardExpirationYear(Object card) {
+ return ((ResultCard) card).getExpirationYear();
+ }
+
+ @CalledByNative
+ private static String getWalletCardPan(Object card) {
+ return ((ResultCard) card).getPan();
+ }
+
+ @CalledByNative
+ private static String getWalletCardCvn(Object card) {
+ return ((ResultCard) card).getCvn();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698