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

Unified Diff: chrome/browser/dom_ui/autofill_options_handler.cc

Issue 3140026: DOMUI: Implement the 'Remove...' button on the AutoFill page. (Closed)
Patch Set: DOMUI fixes. Created 10 years, 4 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/dom_ui/autofill_options_handler.cc
diff --git a/chrome/browser/dom_ui/autofill_options_handler.cc b/chrome/browser/dom_ui/autofill_options_handler.cc
index 689ea83b581568a535605e4e498d047c41eea3a4..4ae032cd751f0070cc6745936261084fadf8b0ff 100644
--- a/chrome/browser/dom_ui/autofill_options_handler.cc
+++ b/chrome/browser/dom_ui/autofill_options_handler.cc
@@ -72,6 +72,13 @@ void AutoFillOptionsHandler::OnPersonalDataChanged() {
}
void AutoFillOptionsHandler::RegisterMessages() {
+ dom_ui_->RegisterMessageCallback(
+ "removeAddress",
+ NewCallback(this, &AutoFillOptionsHandler::RemoveAddress));
+
+ dom_ui_->RegisterMessageCallback(
+ "removeCreditCard",
+ NewCallback(this, &AutoFillOptionsHandler::RemoveCreditCard));
}
void AutoFillOptionsHandler::LoadAutoFillData() {
@@ -84,6 +91,7 @@ void AutoFillOptionsHandler::LoadAutoFillData() {
i != personal_data_->profiles().end(); ++i) {
DictionaryValue* address = new DictionaryValue();
address->SetString("label", (*i)->PreviewSummary());
+ address->SetInteger("unique_id", (*i)->unique_id());
addresses.Append(address);
}
@@ -96,9 +104,36 @@ void AutoFillOptionsHandler::LoadAutoFillData() {
i != personal_data_->credit_cards().end(); ++i) {
DictionaryValue* credit_card = new DictionaryValue();
credit_card->SetString("label", (*i)->PreviewSummary());
+ credit_card->SetInteger("unique_id", (*i)->unique_id());
credit_cards.Append(credit_card);
}
dom_ui_->CallJavascriptFunction(L"AutoFillOptions.updateCreditCards",
credit_cards);
}
+
+void AutoFillOptionsHandler::RemoveAddress(const ListValue* args) {
+ if (!personal_data_->IsDataLoaded())
+ return;
+
+ int unique_id = 0;
+ if (!ExtractIntegerValue(args, &unique_id)) {
+ NOTREACHED();
+ return;
+ }
+
+ personal_data_->RemoveProfile(unique_id);
+}
+
+void AutoFillOptionsHandler::RemoveCreditCard(const ListValue* args) {
+ if (!personal_data_->IsDataLoaded())
+ return;
+
+ int unique_id = 0;
+ if (!ExtractIntegerValue(args, &unique_id)) {
+ NOTREACHED();
+ return;
+ }
+
+ personal_data_->RemoveCreditCard(unique_id);
+}
« no previous file with comments | « chrome/browser/dom_ui/autofill_options_handler.h ('k') | chrome/browser/resources/options/autofill_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698