OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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.autofill; | 5 package org.chromium.chrome.browser.autofill; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 void onFullCardDetails(CreditCard card, String cvc); | 55 void onFullCardDetails(CreditCard card, String cvc); |
56 | 56 |
57 /** | 57 /** |
58 * Called when user did not provide full card details. | 58 * Called when user did not provide full card details. |
59 */ | 59 */ |
60 @CalledByNative("FullCardRequestDelegate") | 60 @CalledByNative("FullCardRequestDelegate") |
61 void onFullCardError(); | 61 void onFullCardError(); |
62 } | 62 } |
63 | 63 |
64 /** | 64 /** |
65 * Callback for normalized addresses. | |
66 */ | |
67 public interface NormalizedAddressRequestDelegate { | |
68 /** | |
69 * Called when the address has been sucessfully normalized. | |
70 * | |
71 * @param profile The profile with the normalized address. | |
72 */ | |
73 @CalledByNative("NormalizedAddressRequestDelegate") | |
74 void onAddressNormalized(AutofillProfile profile); | |
75 } | |
76 | |
77 /** | |
65 * Autofill address information. | 78 * Autofill address information. |
66 */ | 79 */ |
67 public static class AutofillProfile { | 80 public static class AutofillProfile { |
68 private String mGUID; | 81 private String mGUID; |
69 private String mOrigin; | 82 private String mOrigin; |
70 private boolean mIsLocal; | 83 private boolean mIsLocal; |
71 private String mFullName; | 84 private String mFullName; |
72 private String mCompanyName; | 85 private String mCompanyName; |
73 private String mStreetAddress; | 86 private String mStreetAddress; |
74 private String mRegion; | 87 private String mRegion; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 return nativeGetCreditCardUseDateForTesting(mPersonalDataManagerAndroid, guid); | 724 return nativeGetCreditCardUseDateForTesting(mPersonalDataManagerAndroid, guid); |
712 } | 725 } |
713 | 726 |
714 @VisibleForTesting | 727 @VisibleForTesting |
715 long getCurrentDateForTesting() { | 728 long getCurrentDateForTesting() { |
716 ThreadUtils.assertOnUiThread(); | 729 ThreadUtils.assertOnUiThread(); |
717 return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid); | 730 return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid); |
718 } | 731 } |
719 | 732 |
720 /** | 733 /** |
734 * Starts loading the address validation rules for the specified {@code regi onCode}. | |
735 * | |
736 * @param regionCode The code of the region for which to load the rules. | |
737 */ | |
738 public void loadRulesForRegion(String regionCode) { | |
739 ThreadUtils.assertOnUiThread(); | |
740 nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode); | |
741 } | |
742 | |
743 /** | |
744 * Sets up the callback to start normalizing the address of the profile asso ciated with the | |
745 * {@code guid} when the rules associated with the {@code regionCode} are do ne loading. After | |
746 * completion, the normalized profile will be sent to the {@code requester}. | |
gone
2016/09/28 18:04:31
I don't think you have a |requester| anymore.
sebsg
2016/09/28 18:50:39
Done.
| |
747 * | |
748 * @param guid The GUID of the profile to normalize. | |
749 * @param regionCode The region code indicating which rules to use for norma lization. | |
750 * @param requester The object requesting the normalization. | |
751 */ | |
752 public void normalizeAddressAsync( | |
753 String guid, String regionCode, NormalizedAddressRequestDelegate del egate) { | |
754 ThreadUtils.assertOnUiThread(); | |
755 nativeStartAddressNormalizationTask( | |
756 mPersonalDataManagerAndroid, guid, regionCode, delegate); | |
757 } | |
758 | |
759 /** Cancels the pending address normalization. */ | |
760 public void cancelPendingAddressNormalization() { | |
761 ThreadUtils.assertOnUiThread(); | |
762 nativeCancelPendingAddressNormalization(mPersonalDataManagerAndroid); | |
763 } | |
764 | |
765 /** | |
721 * @return Whether the Autofill feature is enabled. | 766 * @return Whether the Autofill feature is enabled. |
722 */ | 767 */ |
723 public static boolean isAutofillEnabled() { | 768 public static boolean isAutofillEnabled() { |
724 return nativeIsAutofillEnabled(); | 769 return nativeIsAutofillEnabled(); |
725 } | 770 } |
726 | 771 |
727 /** | 772 /** |
728 * Enables or disables the Autofill feature. | 773 * Enables or disables the Autofill feature. |
729 * @param enable True to disable Autofill, false otherwise. | 774 * @param enable True to disable Autofill, false otherwise. |
730 */ | 775 */ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 long nativePersonalDataManagerAndroid, String guid, int count, long date); | 844 long nativePersonalDataManagerAndroid, String guid, int count, long date); |
800 private native int nativeGetCreditCardUseCountForTesting(long nativePersonal DataManagerAndroid, | 845 private native int nativeGetCreditCardUseCountForTesting(long nativePersonal DataManagerAndroid, |
801 String guid); | 846 String guid); |
802 private native long nativeGetCreditCardUseDateForTesting(long nativePersonal DataManagerAndroid, | 847 private native long nativeGetCreditCardUseDateForTesting(long nativePersonal DataManagerAndroid, |
803 String guid); | 848 String guid); |
804 private native long nativeGetCurrentDateForTesting(long nativePersonalDataMa nagerAndroid); | 849 private native long nativeGetCurrentDateForTesting(long nativePersonalDataMa nagerAndroid); |
805 private native void nativeClearUnmaskedCache( | 850 private native void nativeClearUnmaskedCache( |
806 long nativePersonalDataManagerAndroid, String guid); | 851 long nativePersonalDataManagerAndroid, String guid); |
807 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, | 852 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, |
808 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); | 853 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); |
854 private native void nativeLoadRulesForRegion( | |
855 long nativePersonalDataManagerAndroid, String regionCode); | |
856 private native void nativeStartAddressNormalizationTask(long nativePersonalD ataManagerAndroid, | |
857 String guid, String regionCode, NormalizedAddressRequestDelegate del egate); | |
858 private native void nativeCancelPendingAddressNormalization( | |
859 long nativePersonalDataManagerAndroid); | |
809 private static native boolean nativeIsAutofillEnabled(); | 860 private static native boolean nativeIsAutofillEnabled(); |
810 private static native void nativeSetAutofillEnabled(boolean enable); | 861 private static native void nativeSetAutofillEnabled(boolean enable); |
811 private static native boolean nativeIsAutofillManaged(); | 862 private static native boolean nativeIsAutofillManaged(); |
812 private static native boolean nativeIsPaymentsIntegrationEnabled(); | 863 private static native boolean nativeIsPaymentsIntegrationEnabled(); |
813 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); | 864 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); |
814 private static native String nativeToCountryCode(String countryName); | 865 private static native String nativeToCountryCode(String countryName); |
815 } | 866 } |
OLD | NEW |