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 ca700932942c19cfeb0b54804d33e976f2460145..87d1dadecc8dcf521cb7f399ace63425698bc361 100644 |
--- a/components/autofill/core/browser/personal_data_manager.cc |
+++ b/components/autofill/core/browser/personal_data_manager.cc |
@@ -735,9 +735,22 @@ void PersonalDataManager::RemoveByGUID(const std::string& guid) { |
if (is_credit_card) |
Mathieu
2017/05/17 15:55:32
add curlies
sebsg
2017/05/17 15:59:16
Done.
|
database_->RemoveCreditCard(guid); |
- else |
+ else { |
database_->RemoveAutofillProfile(guid); |
+ // Reset the billing_address_id of any card that refered to this profile. |
+ for (CreditCard* credit_card : GetCreditCards()) { |
+ if (credit_card->billing_address_id() == guid) { |
+ credit_card->set_billing_address_id(""); |
+ |
+ if (credit_card->record_type() == CreditCard::LOCAL_CARD) |
+ database_->UpdateCreditCard(*credit_card); |
+ else |
+ database_->UpdateServerCardMetadata(*credit_card); |
+ } |
+ } |
+ } |
+ |
// Refresh our local cache and send notifications to observers. |
Refresh(); |
} |