Chromium Code Reviews| Index: chrome/browser/autofill/android/personal_data_manager_android.h |
| diff --git a/chrome/browser/autofill/android/personal_data_manager_android.h b/chrome/browser/autofill/android/personal_data_manager_android.h |
| index 801e8b6c0fe65b5841dea731d4a7ce07e2928241..406d8ca80c0b80d0e4583a9c7ead1c18900c0c4a 100644 |
| --- a/chrome/browser/autofill/android/personal_data_manager_android.h |
| +++ b/chrome/browser/autofill/android/personal_data_manager_android.h |
| @@ -12,16 +12,26 @@ |
| #include "components/autofill/core/browser/personal_data_manager.h" |
| #include "components/autofill/core/browser/personal_data_manager_observer.h" |
| #include "components/payments/core/address_normalizer.h" |
| +#include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
| namespace autofill { |
| // Android wrapper of the PersonalDataManager which provides access from the |
| // Java layer. Note that on Android, there's only a single profile, and |
| // therefore a single instance of this wrapper. |
| -class PersonalDataManagerAndroid : public PersonalDataManagerObserver { |
| +class PersonalDataManagerAndroid |
| + : public PersonalDataManagerObserver, |
| + public LoadRulesListener, |
| + public base::SupportsWeakPtr<PersonalDataManagerAndroid> { |
| public: |
| // Registers the JNI bindings for this class. |
| static bool Register(JNIEnv* env); |
| + // The interface for the sub-key request. |
| + class SubKeyRequestDelegate { |
| + public: |
| + virtual void OnRulesSuccessfullyLoaded() = 0; |
| + virtual ~SubKeyRequestDelegate() {} |
| + }; |
|
please use gerrit instead
2017/03/30 18:48:58
Let's put the interface first in the class (before
Parastoo
2017/03/31 15:44:14
Done.
|
| PersonalDataManagerAndroid(JNIEnv* env, jobject obj); |
| @@ -284,7 +294,14 @@ class PersonalDataManagerAndroid : public PersonalDataManagerObserver { |
| // Starts loading the address validation rules for the specified |
| // |region_code|. |
| - void LoadRulesForRegion( |
| + void LoadRulesForAddressNormalization( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& unused_obj, |
| + const base::android::JavaParamRef<jstring>& region_code); |
| + |
| + // Starts loading the rules for the specified |region_code| for the further |
| + // sub-key request. |
| + void LoadRulesForSubKeys( |
| JNIEnv* env, |
| const base::android::JavaParamRef<jobject>& unused_obj, |
| const base::android::JavaParamRef<jstring>& region_code); |
| @@ -312,6 +329,31 @@ class PersonalDataManagerAndroid : public PersonalDataManagerObserver { |
| JNIEnv* env, |
| const base::android::JavaParamRef<jobject>& unused_obj); |
| + // Gets the sub-keys for the region with |jregion_code| code, if the |
| + // |jregion_code| rules have finished loading. Otherwise, sets up a task to |
| + // get the sub-keys, when the rules are loaded. |
| + void StartRegionSubKeysRequest( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& unused_obj, |
| + const base::android::JavaParamRef<jstring>& jregion_code, |
| + const base::android::JavaParamRef<jobject>& jdelegate); |
| + |
| + // Gets the sub-keys of the rule associated with |jregion_code|. Should only |
| + // be called when the rules are loaded. |
| + base::android::ScopedJavaLocalRef<jobjectArray> GetSubKeys( |
| + JNIEnv* env, |
| + const std::string& jregion_code); |
| + |
| + // Callback of the sub-keys request. |
| + // This is called when the sub-keys are loaded. |
| + void OnAddressRulesLoaded(const std::string& region_code, |
| + bool success) override; |
| + |
| + // Cancels the pending sub-key request task. |
| + void CancelPendingGetSubKeys( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& unused_obj); |
| + |
| private: |
| ~PersonalDataManagerAndroid() override; |
| @@ -359,9 +401,16 @@ class PersonalDataManagerAndroid : public PersonalDataManagerObserver { |
| // Pointer to the PersonalDataManager for the main profile. |
| PersonalDataManager* personal_data_manager_; |
| - // The address validator used to normalize addresses. |
| + // The address validator used to normalize address. |
| payments::AddressNormalizer address_normalizer_; |
|
please use gerrit instead
2017/03/30 18:48:58
payments::AddressNormalizer has an AddressValidato
Parastoo
2017/03/31 15:44:14
In the next CL (that is almost done), all these co
please use gerrit instead
2017/03/31 16:06:20
I'm fairly certain that disk storage will be share
Parastoo
2017/04/03 16:18:23
Acknowledged.
|
| + // The address validator used for sub key request. |
| + AddressValidator address_validator_; |
| + |
| + // The region code and the request for the pending sub-key request. |
| + std::unique_ptr<SubKeyRequestDelegate> pending_subkey_request_; |
| + std::string pending_subkey_region_code_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
| }; |