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

Unified Diff: components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h

Issue 2619423002: [Payments] Preserve Wallet's card to billing address link after sync. (Closed)
Patch Set: Fixed comment 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/webdata/autofill_wallet_syncable_service.h
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h
index eb4b9e044efa553e98b13184cdfeabd96ff680be..03f1311640913703d7bcc4e45a34effc42f5e112 100644
--- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h
+++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h
@@ -8,10 +8,13 @@
#include "base/macros.h"
#include "base/supports_user_data.h"
#include "base/threading/thread_checker.h"
+#include "components/autofill/core/browser/autofill_profile.h"
+#include "components/autofill/core/browser/credit_card.h"
#include "components/sync/model/syncable_service.h"
namespace autofill {
+class AutofillTable;
class AutofillWebDataBackend;
class AutofillWebDataService;
@@ -58,8 +61,33 @@ class AutofillWalletSyncableService
const std::string& app_locale);
private:
+ FRIEND_TEST_ALL_PREFIXES(
+ AutofillWalletSyncableServiceTest,
+ CopyRelevantBillingAddressesFromDisk_KeepLocalAddresses);
+ FRIEND_TEST_ALL_PREFIXES(
+ AutofillWalletSyncableServiceTest,
+ CopyRelevantBillingAddressesFromDisk_OverwriteOtherAddresses);
+ FRIEND_TEST_ALL_PREFIXES(
+ AutofillWalletSyncableServiceTest,
+ PopulateWalletCardsAndAddresses_BillingAddressIdTransfer);
+
syncer::SyncMergeResult SetSyncData(const syncer::SyncDataList& data_list);
+ // Populates the wallet cards and addresses from the sync data and uses the
+ // sync data to link the card to its billing address.
+ static void PopulateWalletCardsAndAddresses(
+ const syncer::SyncDataList& data_list,
+ std::vector<CreditCard>* wallet_cards,
+ std::vector<AutofillProfile>* wallet_addresses);
+
+ // Finds the copies of the same credit card from the server and on disk and
+ // overwrites the server version with the billing id saved on disk if it
+ // refers to a local autofill profile. The credit card's IDs do not change
+ // over time.
+ static void CopyRelevantBillingAddressesFromDisk(
+ const AutofillTable& table,
+ std::vector<CreditCard>* cards_from_server);
+
base::ThreadChecker thread_checker_;
AutofillWebDataBackend* webdata_backend_; // Weak ref.

Powered by Google App Engine
This is Rietveld 408576698