| 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..f39617edccb56ab45399f37e27989def07e4312c 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,41 @@ 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);
|
| + }
|
| +
|
| + /**
|
| + * 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}.
|
| + *
|
| + * @param guid The GUID of the profile to normalize.
|
| + * @param regionCode The region code indicating which rules to use for normalization.
|
| + * @param delegate The object requesting the normalization.
|
| + *
|
| + * @return Whether the normalization will happen asynchronously.
|
| + */
|
| + public boolean normalizeAddress(
|
| + String guid, String regionCode, NormalizedAddressRequestDelegate delegate) {
|
| + ThreadUtils.assertOnUiThread();
|
| + return nativeStartAddressNormalization(
|
| + 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 +854,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 boolean nativeStartAddressNormalization(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();
|
|
|