Chromium Code Reviews| Index: chrome/browser/autofill/autofill_manager.cc |
| diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc |
| index 9a16f3f24bcd42a468823f881af29bdde6d3ef1e..16926257355b87ffeebeef792b9173b868f83746 100644 |
| --- a/chrome/browser/autofill/autofill_manager.cc |
| +++ b/chrome/browser/autofill/autofill_manager.cc |
| @@ -687,6 +687,26 @@ void AutofillManager::OnShowPasswordGenerationPopup(const gfx::Rect& bounds) { |
| #endif // #if defined(OS_ANDROID) |
| } |
| +void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
| + const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); |
|
Ilya Sherman
2012/04/18 18:12:51
nit: indentation?
csharp
2012/04/19 15:33:24
Done.
|
| + const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); |
| + const AutofillProfile* profile = NULL; |
| + const CreditCard* credit_card = NULL; |
| + size_t variant = 0; |
|
Ilya Sherman
2012/04/18 18:12:51
Hmm, I wonder if we should really delete the whole
csharp
2012/04/19 15:33:24
That sounds good to me. I did a little poking arou
|
| + if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, |
| + &credit_card, &variant)) |
| + return; |
|
Ilya Sherman
2012/04/18 18:12:51
nit: I think we can add a NOTREACHED() to this if-
csharp
2012/04/19 15:33:24
Seems reasonable. If we get here then so thing has
|
| + |
| + if (!personal_data_) |
| + return; |
|
Ilya Sherman
2012/04/18 18:12:51
You already used personal_data_ above... (lines 69
csharp
2012/04/19 15:33:24
That's what I get for copy the GetProfileOrCreditC
|
| + |
| + if (profile) { |
| + personal_data_->RemoveProfile(profile->guid()); |
| + } else if (credit_card) { |
|
Ilya Sherman
2012/04/18 18:12:51
nit: No need for the "if" part of the else stmt --
csharp
2012/04/19 15:33:24
Done.
|
| + personal_data_->RemoveCreditCard(credit_card->guid()); |
| + } |
|
Ilya Sherman
2012/04/18 18:12:51
nit: No need for curly braces.
csharp
2012/04/19 15:33:24
Done.
|
| +} |
| + |
| void AutofillManager::OnAddPasswordFormMapping( |
| const webkit::forms::FormField& form, |
| const webkit::forms::PasswordFormFillData& fill_data) { |