Chromium Code Reviews| Index: components/autofill/core/browser/personal_data_manager.h |
| diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h |
| index a6de3acbf6a198e74458ef48805fd0af9b83fdf1..d3fb6b9667d7d069f7f50e4d59b2919a1c288243 100644 |
| --- a/components/autofill/core/browser/personal_data_manager.h |
| +++ b/components/autofill/core/browser/personal_data_manager.h |
| @@ -183,18 +183,18 @@ class PersonalDataManager : public KeyedService, |
| // This PersonalDataManager owns these profiles and credit cards. Their |
| // lifetime is until the web database is updated with new profile and credit |
| - // card information, respectively. |GetProfiles()| returns both web and |
| - // auxiliary profiles. |web_profiles()| returns only web profiles. |
| + // card information, respectively. |
| + // TODO(crbug.com/687352): Remove one of these since they do the same thing. |
| + // |GetProfiles()| and |web_profiles()| returns only local profiles. |
| virtual const std::vector<AutofillProfile*>& GetProfiles() const; |
| virtual std::vector<AutofillProfile*> web_profiles() const; |
| + // Returns just SERVER_PROFILES. |
| + virtual std::vector<AutofillProfile*> server_profiles() const; |
| // Returns just LOCAL_CARD cards. |
| virtual std::vector<CreditCard*> GetLocalCreditCards() const; |
| // Returns all credit cards, server and local. |
| virtual const std::vector<CreditCard*>& GetCreditCards() const; |
| - // Returns true if there is some data synced from Wallet. |
| - bool HasServerData() const; |
| - |
| // Returns the profiles to suggest to the user, ordered by frecency. |
| const std::vector<AutofillProfile*> GetProfilesToSuggest() const; |
| @@ -316,6 +316,16 @@ class PersonalDataManager : public KeyedService, |
| ApplyDedupingRoutine_OncePerVersion); |
| FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
| ApplyDedupingRoutine_MultipleDedupes); |
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
| + ConvertWalletAddressesToLocalProfiles_NewProfile); |
| + FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, |
| + ConvertWalletAddressesToLocalProfiles_MergedProfile); |
| + FRIEND_TEST_ALL_PREFIXES( |
| + PersonalDataManagerTest, |
| + ConvertWalletAddressesToLocalProfiles_AlreadyConverted); |
| + FRIEND_TEST_ALL_PREFIXES( |
| + PersonalDataManagerTest, |
| + ConvertWalletAddressesToLocalProfiles_MultipleSimilarWalletAddresses); |
| friend class autofill::AutofillInteractiveTest; |
| friend class autofill::AutofillTest; |
| friend class autofill::PersonalDataManagerFactory; |
| @@ -502,6 +512,20 @@ class PersonalDataManager : public KeyedService, |
| void UpdateCardsBillingAddressReference( |
| const std::unordered_map<std::string, std::string>& guids_merge_map); |
| + // Converts the wallet addresses to local autofill profiles. This should be |
| + // called after all the syncable data has been processed (local cards and |
| + // profiles, wallet data and metadata). |
| + void ConvertWalletAddressesToLocalProfiles(); |
| + |
| + // Tries to merge the |server_address| into the |existing_profiles| if |
| + // possible. Adds it to the list if no match is found. The existing profiles |
| + // should be sorted by decreasing frecency outside of this method, since this |
| + // will be called multiple times in a row. Returns the guid of the new or |
| + // updated profile. |
| + std::string MergeServerAddressesIntoProfiles( |
| + const AutofillProfile& server_address, |
| + std::vector<AutofillProfile>* existing_profiles); |
| + |
| const std::string app_locale_; |
| // The default country code for new addresses. |
| @@ -541,6 +565,9 @@ class PersonalDataManager : public KeyedService, |
| // True if autofill profile cleanup needs to be performed. |
| bool is_autofill_profile_cleanup_pending_ = false; |
| + // Whether new information was received from the sync server. |
| + bool has_synced_new_data = false; |
|
Mathieu
2017/02/02 15:52:30
has_synced_new_data_?
sebsg
2017/02/02 16:38:27
Done.
|
| + |
| #if defined(OS_ANDROID) |
| // The context for the request to be used to fetch libaddressinput's address |
| // validation rules. |