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

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: nit Created 3 years, 9 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 2428e99e1118b820bb7f499142e22abd6d26a6f6..2f07eef339f05f1ff6376bc2f7d41d74506c3de1 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 {
@@ -805,16 +818,36 @@ 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();
+ nativeLoadRulesForAddressNormalization(mPersonalDataManagerAndroid, regionCode);
+ }
+
+ /**
+ * Starts loading the sub-key request rules for the specified {@code regionCode}.
+ *
+ * @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();
- nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode);
+ nativeStartRegionSubKeysRequest(mPersonalDataManagerAndroid, regionCode, delegate);
}
/**
- * Normalizes the address of the {@code profile} if the rules 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
+ * Normalizes the address of the profile associated with the {@code guid} if the rules
+ * 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.
*
* @param profile The profile to normalize.
@@ -828,6 +861,12 @@ public class PersonalDataManager {
sNormalizationTimeoutSeconds, delegate);
}
+ /** Cancels the pending sub keys request. */
+ public void cancelPendingGetSubKeys() {
+ ThreadUtils.assertOnUiThread();
+ nativeCancelPendingGetSubKeys(mPersonalDataManagerAndroid);
+ }
gone 2017/04/05 00:14:20 Put this next to getRegionSubKeys instead of split
Parastoo 2017/04/05 19:49:06 Done.
+
/**
* Checks whether the Autofill PersonalDataManager has profiles.
*
@@ -888,6 +927,10 @@ public class PersonalDataManager {
sNormalizationTimeoutSeconds = timeout;
}
+ public static int getRequestTimeoutMS() {
+ return sNormalizationTimeoutSeconds * 1000;
gone 2017/04/05 00:14:20 return TimeUnit.SECONDS.toMillis(sNormalizationTim
Parastoo 2017/04/05 19:49:06 Done.
+ }
+
private native long nativeInit();
private native boolean nativeIsDataLoaded(long nativePersonalDataManagerAndroid);
private native String[] nativeGetProfileGUIDsForSettings(long nativePersonalDataManagerAndroid);
@@ -947,11 +990,15 @@ 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 nativeStartAddressNormalization(long nativePersonalDataManagerAndroid,
AutofillProfile profile, String regionCode, int timeoutSeconds,
NormalizedAddressRequestDelegate delegate);
+ private native void nativeStartRegionSubKeysRequest(long nativePersonalDataManagerAndroid,
+ String regionCode, GetSubKeysRequestDelegate delegate);
private static native boolean nativeHasProfiles(long nativePersonalDataManagerAndroid);
private static native boolean nativeHasCreditCards(long nativePersonalDataManagerAndroid);
private static native boolean nativeIsAutofillEnabled();
@@ -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