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

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

Issue 2109643003: Add billing address to masked server credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete AutofillServerCardPreferences.java Created 4 years, 6 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.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 781ddd080fb2b4c50257e84120e601ea2eadb5df..9dad674efa5a3b008259a179932581bce5d8963e 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -584,6 +584,33 @@ void PersonalDataManager::UpdateServerCreditCard(
Refresh();
}
+void PersonalDataManager::UpdateServerCardBillingAddress(
+ const CreditCard& credit_card) {
+ DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type());
+
+ if (!database_.get())
+ return;
+
+ CreditCard* existing_credit_card = nullptr;
+ for (auto it : server_credit_cards_) {
+ if (credit_card.guid() == it->guid()) {
+ existing_credit_card = it;
+ break;
+ }
+ }
+ if (!existing_credit_card
+ || existing_credit_card->billing_address_id() ==
+ credit_card.billing_address_id()) {
+ return;
+ }
+
+ existing_credit_card->set_billing_address_id(
+ credit_card.billing_address_id());
+ database_->UpdateServerCardBillingAddress(*existing_credit_card);
+
+ Refresh();
+}
+
void PersonalDataManager::ResetFullServerCard(const std::string& guid) {
for (const CreditCard* card : server_credit_cards_) {
if (card->guid() == guid) {

Powered by Google App Engine
This is Rietveld 408576698