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 9f766ea3f9f281c2e2b1debb554667d13f8f3f10..d6c311f22c2a7d11bf4cf4b410de6cab85c11d23 100644 |
--- a/components/autofill/core/browser/personal_data_manager.cc |
+++ b/components/autofill/core/browser/personal_data_manager.cc |
@@ -585,6 +585,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) { |