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

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: Rebase 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
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 1ec53e74eceda2afed3dfe4ac9bb59493d443dd2..63c051a924e11af6ca65e85d7f69a2731cc33971 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -57,13 +57,13 @@
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "ipc/ipc_message_macros.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/rect.h"
#include "webkit/forms/form_data.h"
#include "webkit/forms/form_data_predictions.h"
#include "webkit/forms/form_field.h"
#include "webkit/forms/password_form_dom_manager.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
using base::TimeTicks;
using content::BrowserThread;
@@ -697,6 +697,30 @@ 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, instead of doing nothing.
+ // http://crbug.com/124211
+ if (variant != 0)
+ return;
+
+ 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) {
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698