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 059cee3757afa2eca75e2c541bc7800c3fc1f238..f6f83236a15028933e9d96d196a19157acafce4d 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 normalized addresses. |
+ */ |
+ public interface NormalizedAddressRequestDelegate { |
+ /** |
+ * Called when the address has been sucessfully normalized. |
+ * |
+ * @param profile The profile with the normalized address. |
+ */ |
+ @CalledByNative("NormalizedAddressRequestDelegate") |
+ void onAddressNormalized(AutofillProfile profile); |
+ } |
+ |
+ /** |
* Autofill address information. |
*/ |
public static class AutofillProfile { |
@@ -718,6 +731,38 @@ public class PersonalDataManager { |
} |
/** |
+ * Starts loading the address validation rules for the specified {@code regionCode}. |
+ * |
+ * @param regionCode The code of the region for which to load the rules. |
+ */ |
+ public void loadRulesForRegion(String regionCode) { |
+ ThreadUtils.assertOnUiThread(); |
+ nativeLoadRulesForRegion(mPersonalDataManagerAndroid, regionCode); |
+ } |
+ |
+ /** |
+ * Sets up the callback to start normalizing the address of the profile associated with the |
+ * {@code guid} when the rules associated with the {@code regionCode} are done loading. After |
+ * 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.
|
+ * |
+ * @param guid The GUID of the profile to normalize. |
+ * @param regionCode The region code indicating which rules to use for normalization. |
+ * @param requester The object requesting the normalization. |
+ */ |
+ public void normalizeAddressAsync( |
+ String guid, String regionCode, NormalizedAddressRequestDelegate delegate) { |
+ ThreadUtils.assertOnUiThread(); |
+ nativeStartAddressNormalizationTask( |
+ mPersonalDataManagerAndroid, guid, regionCode, delegate); |
+ } |
+ |
+ /** Cancels the pending address normalization. */ |
+ public void cancelPendingAddressNormalization() { |
+ ThreadUtils.assertOnUiThread(); |
+ nativeCancelPendingAddressNormalization(mPersonalDataManagerAndroid); |
+ } |
+ |
+ /** |
* @return Whether the Autofill feature is enabled. |
*/ |
public static boolean isAutofillEnabled() { |
@@ -806,6 +851,12 @@ public class PersonalDataManager { |
long nativePersonalDataManagerAndroid, String guid); |
private native void nativeGetFullCardForPaymentRequest(long nativePersonalDataManagerAndroid, |
WebContents webContents, CreditCard card, FullCardRequestDelegate delegate); |
+ private native void nativeLoadRulesForRegion( |
+ long nativePersonalDataManagerAndroid, String regionCode); |
+ private native void nativeStartAddressNormalizationTask(long nativePersonalDataManagerAndroid, |
+ String guid, String regionCode, NormalizedAddressRequestDelegate delegate); |
+ private native void nativeCancelPendingAddressNormalization( |
+ long nativePersonalDataManagerAndroid); |
private static native boolean nativeIsAutofillEnabled(); |
private static native void nativeSetAutofillEnabled(boolean enable); |
private static native boolean nativeIsAutofillManaged(); |