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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java

Issue 2680143002: Use dropdown list for admin areas in pr form. (Closed)
Patch Set: nit Created 3 years, 8 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 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
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 subKeys request.
66 */
67 public interface GetSubKeysRequestDelegate {
68 /**
69 * Called when the sub-keys are received sucessfully.
70 *
71 * @param subKeys The subKeys.
72 */
73 @CalledByNative("GetSubKeysRequestDelegate")
74 void onSubKeysReceived(String[] subKeys);
75 }
76
77 /**
65 * Callback for normalized addresses. 78 * Callback for normalized addresses.
66 */ 79 */
67 public interface NormalizedAddressRequestDelegate { 80 public interface NormalizedAddressRequestDelegate {
68 /** 81 /**
69 * Called when the address has been sucessfully normalized. 82 * Called when the address has been sucessfully normalized.
70 * 83 *
71 * @param profile The profile with the normalized address. 84 * @param profile The profile with the normalized address.
72 */ 85 */
73 @CalledByNative("NormalizedAddressRequestDelegate") 86 @CalledByNative("NormalizedAddressRequestDelegate")
74 void onAddressNormalized(AutofillProfile profile); 87 void onAddressNormalized(AutofillProfile profile);
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 long getCurrentDateForTesting() { 811 long getCurrentDateForTesting() {
799 ThreadUtils.assertOnUiThread(); 812 ThreadUtils.assertOnUiThread();
800 return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid); 813 return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid);
801 } 814 }
802 815
803 /** 816 /**
804 * Starts loading the address validation rules for the specified {@code regi onCode}. 817 * Starts loading the address validation rules for the specified {@code regi onCode}.
805 * 818 *
806 * @param regionCode The code of the region for which to load the rules. 819 * @param regionCode The code of the region for which to load the rules.
807 */ 820 */
808 public void loadRulesForRegion(String regionCode) { 821 public void loadRulesForAddressNormalization(String regionCode) {
809 ThreadUtils.assertOnUiThread(); 822 ThreadUtils.assertOnUiThread();
810 nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode); 823 nativeLoadRulesForAddressNormalization(mPersonalDataManagerAndroid, regi onCode);
811 } 824 }
812 825
813 /** 826 /**
814 * Normalizes the address of the {@code profile} if the rules associated wit h the 827 * Starts loading the sub-key request rules for the specified {@code regionC ode}.
815 * {@code regionCode} are done loading. Otherwise sets up the callback to st art normalizing the 828 *
816 * address when the rules are loaded. The normalized profile will be sent to the 829 * @param regionCode The code of the region for which to load the rules.
817 * {@code delegate}. If the profile is not normalized in the specified 830 */
831 public void loadRulesForSubKeys(String regionCode) {
832 ThreadUtils.assertOnUiThread();
833 nativeLoadRulesForSubKeys(mPersonalDataManagerAndroid, regionCode);
834 }
835
836 /**
837 * Starts loading the sub keys for the specified {@code regionCode}.
838 *
839 * @param regionCode The code of the region for which to load the sub keys.
840 */
841 public void getRegionSubKeys(String regionCode, GetSubKeysRequestDelegate de legate) {
842 ThreadUtils.assertOnUiThread();
843 nativeStartRegionSubKeysRequest(mPersonalDataManagerAndroid, regionCode, delegate);
844 }
845
846 /**
847 * Normalizes the address of the profile associated with the {@code guid} if the rules
848 * associated with the {@code regionCode} are done loading. Otherwise sets u p the callback to
849 * start normalizing the address when the rules are loaded. The normalized p rofile will be sent
850 * to the {@code delegate}. If the profile is not normalized in the specifie d
818 * {@code sNormalizationTimeoutSeconds}, the {@code delegate} will be notifi ed. 851 * {@code sNormalizationTimeoutSeconds}, the {@code delegate} will be notifi ed.
819 * 852 *
820 * @param profile The profile to normalize. 853 * @param profile The profile to normalize.
821 * @param regionCode The region code indicating which rules to use for norma lization. 854 * @param regionCode The region code indicating which rules to use for norma lization.
822 * @param delegate The object requesting the normalization. 855 * @param delegate The object requesting the normalization.
823 */ 856 */
824 public void normalizeAddress( 857 public void normalizeAddress(
825 AutofillProfile profile, String regionCode, NormalizedAddressRequest Delegate delegate) { 858 AutofillProfile profile, String regionCode, NormalizedAddressRequest Delegate delegate) {
826 ThreadUtils.assertOnUiThread(); 859 ThreadUtils.assertOnUiThread();
827 nativeStartAddressNormalization(mPersonalDataManagerAndroid, profile, re gionCode, 860 nativeStartAddressNormalization(mPersonalDataManagerAndroid, profile, re gionCode,
828 sNormalizationTimeoutSeconds, delegate); 861 sNormalizationTimeoutSeconds, delegate);
829 } 862 }
830 863
864 /** Cancels the pending sub keys request. */
865 public void cancelPendingGetSubKeys() {
866 ThreadUtils.assertOnUiThread();
867 nativeCancelPendingGetSubKeys(mPersonalDataManagerAndroid);
868 }
gone 2017/04/05 00:14:20 Put this next to getRegionSubKeys instead of split
Parastoo 2017/04/05 19:49:06 Done.
869
831 /** 870 /**
832 * Checks whether the Autofill PersonalDataManager has profiles. 871 * Checks whether the Autofill PersonalDataManager has profiles.
833 * 872 *
834 * @return True If there are profiles. 873 * @return True If there are profiles.
835 */ 874 */
836 public boolean hasProfiles() { 875 public boolean hasProfiles() {
837 return nativeHasProfiles(mPersonalDataManagerAndroid); 876 return nativeHasProfiles(mPersonalDataManagerAndroid);
838 } 877 }
839 878
840 /** 879 /**
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 */ 920 */
882 public static void setPaymentsIntegrationEnabled(boolean enable) { 921 public static void setPaymentsIntegrationEnabled(boolean enable) {
883 nativeSetPaymentsIntegrationEnabled(enable); 922 nativeSetPaymentsIntegrationEnabled(enable);
884 } 923 }
885 924
886 @VisibleForTesting 925 @VisibleForTesting
887 public static void setNormalizationTimeoutForTesting(int timeout) { 926 public static void setNormalizationTimeoutForTesting(int timeout) {
888 sNormalizationTimeoutSeconds = timeout; 927 sNormalizationTimeoutSeconds = timeout;
889 } 928 }
890 929
930 public static int getRequestTimeoutMS() {
931 return sNormalizationTimeoutSeconds * 1000;
gone 2017/04/05 00:14:20 return TimeUnit.SECONDS.toMillis(sNormalizationTim
Parastoo 2017/04/05 19:49:06 Done.
932 }
933
891 private native long nativeInit(); 934 private native long nativeInit();
892 private native boolean nativeIsDataLoaded(long nativePersonalDataManagerAndr oid); 935 private native boolean nativeIsDataLoaded(long nativePersonalDataManagerAndr oid);
893 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid); 936 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid);
894 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid); 937 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid);
895 private native String[] nativeGetProfileLabelsForSettings( 938 private native String[] nativeGetProfileLabelsForSettings(
896 long nativePersonalDataManagerAndroid); 939 long nativePersonalDataManagerAndroid);
897 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid, 940 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid,
898 boolean includeNameInLabel, boolean includeOrganizationInLabel, 941 boolean includeNameInLabel, boolean includeOrganizationInLabel,
899 boolean includeCountryInLabel); 942 boolean includeCountryInLabel);
900 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid, 943 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 long nativePersonalDataManagerAndroid, String guid, int count, long date); 983 long nativePersonalDataManagerAndroid, String guid, int count, long date);
941 private native int nativeGetCreditCardUseCountForTesting(long nativePersonal DataManagerAndroid, 984 private native int nativeGetCreditCardUseCountForTesting(long nativePersonal DataManagerAndroid,
942 String guid); 985 String guid);
943 private native long nativeGetCreditCardUseDateForTesting(long nativePersonal DataManagerAndroid, 986 private native long nativeGetCreditCardUseDateForTesting(long nativePersonal DataManagerAndroid,
944 String guid); 987 String guid);
945 private native long nativeGetCurrentDateForTesting(long nativePersonalDataMa nagerAndroid); 988 private native long nativeGetCurrentDateForTesting(long nativePersonalDataMa nagerAndroid);
946 private native void nativeClearUnmaskedCache( 989 private native void nativeClearUnmaskedCache(
947 long nativePersonalDataManagerAndroid, String guid); 990 long nativePersonalDataManagerAndroid, String guid);
948 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, 991 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid,
949 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); 992 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate);
950 private native void nativeLoadRulesForRegion( 993 private native void nativeLoadRulesForAddressNormalization(
994 long nativePersonalDataManagerAndroid, String regionCode);
995 private native void nativeLoadRulesForSubKeys(
951 long nativePersonalDataManagerAndroid, String regionCode); 996 long nativePersonalDataManagerAndroid, String regionCode);
952 private native void nativeStartAddressNormalization(long nativePersonalDataM anagerAndroid, 997 private native void nativeStartAddressNormalization(long nativePersonalDataM anagerAndroid,
953 AutofillProfile profile, String regionCode, int timeoutSeconds, 998 AutofillProfile profile, String regionCode, int timeoutSeconds,
954 NormalizedAddressRequestDelegate delegate); 999 NormalizedAddressRequestDelegate delegate);
1000 private native void nativeStartRegionSubKeysRequest(long nativePersonalDataM anagerAndroid,
1001 String regionCode, GetSubKeysRequestDelegate delegate);
955 private static native boolean nativeHasProfiles(long nativePersonalDataManag erAndroid); 1002 private static native boolean nativeHasProfiles(long nativePersonalDataManag erAndroid);
956 private static native boolean nativeHasCreditCards(long nativePersonalDataMa nagerAndroid); 1003 private static native boolean nativeHasCreditCards(long nativePersonalDataMa nagerAndroid);
957 private static native boolean nativeIsAutofillEnabled(); 1004 private static native boolean nativeIsAutofillEnabled();
958 private static native void nativeSetAutofillEnabled(boolean enable); 1005 private static native void nativeSetAutofillEnabled(boolean enable);
959 private static native boolean nativeIsAutofillManaged(); 1006 private static native boolean nativeIsAutofillManaged();
960 private static native boolean nativeIsPaymentsIntegrationEnabled(); 1007 private static native boolean nativeIsPaymentsIntegrationEnabled();
961 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); 1008 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e);
962 private static native String nativeToCountryCode(String countryName); 1009 private static native String nativeToCountryCode(String countryName);
1010 private static native void nativeCancelPendingGetSubKeys(long nativePersonal DataManagerAndroid);
963 } 1011 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698