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

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

Issue 2734463004: [Payments] Update server card billing if the address has already converted (Closed)
Patch Set: Addressed comments Created 3 years, 9 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 84fc604a3bb50ea24f203e4414320bc21da74d27..a7f9808e53a9ecf267bb3975218713035d6dc099 100644
--- a/components/autofill/core/browser/personal_data_manager.h
+++ b/components/autofill/core/browser/personal_data_manager.h
@@ -322,16 +322,21 @@ 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);
+ ConvertWalletAddressesAndUpdateWalletCards_NewProfile);
+ FRIEND_TEST_ALL_PREFIXES(
+ PersonalDataManagerTest,
+ ConvertWalletAddressesAndUpdateWalletCards_MergedProfile);
+ FRIEND_TEST_ALL_PREFIXES(
+ PersonalDataManagerTest,
+ ConvertWalletAddressesAndUpdateWalletCards_NewCard_AddressAlreadyConverted);
FRIEND_TEST_ALL_PREFIXES(
PersonalDataManagerTest,
- ConvertWalletAddressesToLocalProfiles_MultipleSimilarWalletAddresses);
+ ConvertWalletAddressesAndUpdateWalletCards_AlreadyConverted);
+ FRIEND_TEST_ALL_PREFIXES(
+ PersonalDataManagerTest,
+ ConvertWalletAddressesAndUpdateWalletCards_MultipleSimilarWalletAddresses);
friend class autofill::AutofillInteractiveTest;
friend class autofill::AutofillTest;
friend class autofill::PersonalDataManagerFactory;
@@ -518,10 +523,31 @@ 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
+ // 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();
+ // profiles, Wallet data and metadata). Also updates Wallet cards' billing
+ // address id to point to the local profiles.
+ void ConvertWalletAddressesAndUpdateWalletCards();
+
+ // Converts the Wallet addresses into local profiles either by merging with an
+ // existing |local_profiles| of by adding a new one. Populates the
+ // |server_id_profiles_map| to be used when updating cards where the address
+ // was already converted. Also populates the |guids_merge_map| to keep the
+ // link between the Wallet address and the equivalent local profile (from
+ // merge or creation).
+ bool ConvertWalletAddressesToLocalProfiles(
+ std::vector<AutofillProfile>* local_profiles,
+ std::unordered_map<std::string, AutofillProfile*>* server_id_profiles_map,
+ std::unordered_map<std::string, std::string>* guids_merge_map);
+
+ // Goes through the Wallet cards to find cards where the billing address is a
+ // Wallet address which was already converted in a previous pass. Looks for a
+ // matching local profile and updates the |guids_merge_map| to make the card
+ // refert to it.
+ bool UpdateWalletCardsAlreadyConvertedBillingAddresses(
+ std::vector<AutofillProfile>* local_profiles,
+ std::unordered_map<std::string, AutofillProfile*>* server_id_profiles_map,
+ std::unordered_map<std::string, std::string>* guids_merge_map);
// 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

Powered by Google App Engine
This is Rietveld 408576698