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

Unified 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: Touch ups Created 3 years, 10 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/PersonalDataManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
index d1fd3ad8218643a8cc7914fbfa786ab0a121c322..50b910e49edf0e228b2a27f4c490d89380121842 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
@@ -62,6 +62,19 @@ public class PersonalDataManager {
}
/**
+ * Callback for subKeys request.
+ */
+ public interface GetSubKeysRequestDelegate {
+ /**
+ * Called when the sub-keys are received sucessfully.
+ *
+ * @param subKeys The subKeys.
+ */
+ @CalledByNative("GetSubKeysRequestDelegate")
+ void onSubKeysReceived(String[] subKeys);
+ }
+
+ /**
* Callback for normalized addresses.
*/
public interface NormalizedAddressRequestDelegate {
@@ -520,7 +533,7 @@ public class PersonalDataManager {
return sManager;
}
- private static int sNormalizationTimeoutSeconds = 5;
+ private static int sLoadingTimeoutSeconds = 5;
private final long mPersonalDataManagerAndroid;
private final List<PersonalDataManagerObserver> mDataObservers =
@@ -805,9 +818,29 @@ public class PersonalDataManager {
*
* @param regionCode The code of the region for which to load the rules.
*/
- public void loadRulesForRegion(String regionCode) {
+ public void loadRulesForAddressNormalization(String regionCode) {
ThreadUtils.assertOnUiThread();
- nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode);
+ nativeLoadRulesForAddressNormalization(mPersonalDataManagerAndroid, regionCode);
+ }
+
+ /**
+ * Starts loading the address validation rules for the specified {@code regionCode}.
sebsg 2017/02/28 16:13:59 s/address validation/ subkeys ?
Parastoo 2017/03/21 14:30:44 Done.
+ *
+ * @param regionCode The code of the region for which to load the rules.
+ */
+ public void loadRulesForSubKeys(String regionCode) {
+ ThreadUtils.assertOnUiThread();
+ nativeLoadRulesForSubKeys(mPersonalDataManagerAndroid, regionCode);
+ }
+
+ /**
+ * Starts loading the sub keys for the specified {@code regionCode}.
+ *
+ * @param regionCode The code of the region for which to load the sub keys.
+ */
+ public void getRegionSubKeys(String regionCode, GetSubKeysRequestDelegate delegate) {
+ ThreadUtils.assertOnUiThread();
+ nativeStartGettingRegionSubKeys(mPersonalDataManagerAndroid, regionCode, delegate);
}
/**
@@ -815,7 +848,7 @@ public class PersonalDataManager {
* associated with the {@code regionCode} are done loading. Otherwise sets up the callback to
* start normalizing the address when the rules are loaded. The normalized profile will be sent
* to the {@code delegate}. If the profile is not normalized in the specified
- * {@code sNormalizationTimeoutSeconds}, the {@code delegate} will be notified.
+ * {@code sLoadingTimeoutSeconds}, the {@code delegate} will be notified.
*
* @param guid The GUID of the profile to normalize.
* @param regionCode The region code indicating which rules to use for normalization.
@@ -825,7 +858,13 @@ public class PersonalDataManager {
String guid, String regionCode, NormalizedAddressRequestDelegate delegate) {
ThreadUtils.assertOnUiThread();
nativeStartAddressNormalization(mPersonalDataManagerAndroid, guid, regionCode,
- sNormalizationTimeoutSeconds, delegate);
+ sLoadingTimeoutSeconds, delegate);
+ }
+
+ /** Cancels the pending sub keys request. */
+ public void cancelPendingGetSubKeys() {
+ ThreadUtils.assertOnUiThread();
+ nativeCancelPendingGetSubKeys(mPersonalDataManagerAndroid);
}
/**
@@ -884,8 +923,12 @@ public class PersonalDataManager {
}
@VisibleForTesting
- public static void setNormalizationTimeoutForTesting(int timeout) {
- sNormalizationTimeoutSeconds = timeout;
+ public static void setLoadingTimeoutForTesting(int timeout) {
+ sLoadingTimeoutSeconds = timeout;
+ }
+
+ public static int getLoadingTimeoutMS() {
+ return sLoadingTimeoutSeconds * 1000;
}
private native long nativeInit();
@@ -947,8 +990,12 @@ public class PersonalDataManager {
long nativePersonalDataManagerAndroid, String guid);
private native void nativeGetFullCardForPaymentRequest(long nativePersonalDataManagerAndroid,
WebContents webContents, CreditCard card, FullCardRequestDelegate delegate);
- private native void nativeLoadRulesForRegion(
+ private native void nativeLoadRulesForAddressNormalization(
+ long nativePersonalDataManagerAndroid, String regionCode);
+ private native void nativeLoadRulesForSubKeys(
long nativePersonalDataManagerAndroid, String regionCode);
+ private native void nativeStartGettingRegionSubKeys(long nativePersonalDataManagerAndroid,
+ String regionCode, GetSubKeysRequestDelegate delegate);
private native void nativeStartAddressNormalization(long nativePersonalDataManagerAndroid,
String guid, String regionCode, int timeoutSeconds,
NormalizedAddressRequestDelegate delegate);
@@ -960,4 +1007,5 @@ public class PersonalDataManager {
private static native boolean nativeIsPaymentsIntegrationEnabled();
private static native void nativeSetPaymentsIntegrationEnabled(boolean enable);
private static native String nativeToCountryCode(String countryName);
+ private static native void nativeCancelPendingGetSubKeys(long nativePersonalDataManagerAndroid);
}

Powered by Google App Engine
This is Rietveld 408576698