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

Unified Diff: components/autofill/core/browser/personal_data_manager.h

Issue 2658843004: [Autofill] Convert wallet addresses to local autofill profiles. (Closed)
Patch Set: Rebase Created 3 years, 11 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
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..495a45acac69456ebab659c33d81c09e6765f6bd 100644
--- a/components/autofill/core/browser/personal_data_manager.h
+++ b/components/autofill/core/browser/personal_data_manager.h
@@ -183,10 +183,13 @@ 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(687352): Remove one of these since they do the same thing.
Mathieu 2017/02/02 01:22:53 nit: TODO(crbug.com/687352)
sebsg 2017/02/02 15:18:51 Done.
+ // |GetProfiles()| and |web_profiles()| returns only web profiles.
Mathieu 2017/02/02 01:22:52 "web" profiles means nothing...
sebsg 2017/02/02 15:18:51 Done.
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.
@@ -316,6 +319,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 +515,19 @@ 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 sync is done.
Mathieu 2017/02/02 01:22:52 can you be more precise with "all sync"
sebsg 2017/02/02 15:18:51 Done.
+ void ConvertWalletAddressesToLocalProfiles();
+
+ // Tries to merge the |server_address| into the |local_profiles| if possible.
+ // Adds it to the list if no match is found. The local 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 MergeServerAddressesIntoLocalProfiles(
+ const AutofillProfile& server_address,
+ std::vector<AutofillProfile>* local_profiles);
+
const std::string app_locale_;
// The default country code for new addresses.
@@ -541,6 +567,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;
+
#if defined(OS_ANDROID)
// The context for the request to be used to fetch libaddressinput's address
// validation rules.

Powered by Google App Engine
This is Rietveld 408576698