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

Unified Diff: chrome/browser/autofill/autofill_manager.cc

Issue 10073018: Add Delete Support to New Autofill UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 0136f79d0b9e286643ad2957b6c761641926f067..ef52812d890a4411d1e3e2ededa9048311d2e751 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -689,6 +689,28 @@ 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();
+ const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards();
+ const AutofillProfile* profile = NULL;
+ const CreditCard* credit_card = NULL;
+ size_t variant = 0;
+ if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile,
+ &credit_card, &variant)) {
+ NOTREACHED();
+ return;
+ }
+
+ // TODO(csharp): If we are dealing with a variant only the variant should
+ // be deleted, not the whole profile.
+ // http://crbug.com/124211
Ilya Sherman 2012/04/19 21:01:57 Hmm, this has the potential for accidental data lo
csharp 2012/04/20 15:03:18 Done.
+
+ if (profile)
+ personal_data_->RemoveProfile(profile->guid());
+ else
+ personal_data_->RemoveCreditCard(credit_card->guid());
+}
+
void AutofillManager::OnAddPasswordFormMapping(
const webkit::forms::FormField& form,
const webkit::forms::PasswordFormFillData& fill_data) {

Powered by Google App Engine
This is Rietveld 408576698