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

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: generalize time out cancelation 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1146bbcd33d2e2544f47cbd6e5e4ac2bbae3488f 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
@@ -18,6 +18,7 @@ import org.chromium.content_public.browser.WebContents;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
/**
* Android wrapper of the PersonalDataManager which provides access from the Java
@@ -62,6 +63,23 @@ public class PersonalDataManager {
}
/**
+ * Callback for subKeys request.
+ */
+ public interface GetSubKeysRequestDelegate {
+ /**
+ * Called when the sub-keys are received sucessfully.
+ *
+ * @param subKeys The subKeys.
+ */
+ @CalledByNative("GetSubKeysRequestDelegate")
+ /**
+ * Callback of the sub-keys request that is called when the sub-keys are loaded.
+ * Here the sub-keys are admin areas (sub-keys of the region=country.)
+ */
gone 2017/04/05 20:21:38 Double-javadocing doesn't work. Combine this comm
Parastoo 2017/04/05 20:44:32 Done.
+ void onSubKeysReceived(String[] subKeys);
+ }
+
+ /**
* Callback for normalized addresses.
*/
public interface NormalizedAddressRequestDelegate {
@@ -805,16 +823,42 @@ 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();
+ nativeStartRegionSubKeysRequest(mPersonalDataManagerAndroid, regionCode, delegate);
+ }
+
+ /** Cancels the pending sub keys request. */
+ public void cancelPendingGetSubKeys() {
ThreadUtils.assertOnUiThread();
- nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode);
+ nativeCancelPendingGetSubKeys(mPersonalDataManagerAndroid);
}
/**
- * 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.
@@ -888,6 +932,10 @@ public class PersonalDataManager {
sNormalizationTimeoutSeconds = timeout;
}
+ public static long getRequestTimeoutMS() {
+ return TimeUnit.SECONDS.toMillis(sNormalizationTimeoutSeconds);
+ }
+
private native long nativeInit();
private native boolean nativeIsDataLoaded(long nativePersonalDataManagerAndroid);
private native String[] nativeGetProfileGUIDsForSettings(long nativePersonalDataManagerAndroid);
@@ -947,11 +995,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 +1012,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);
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698