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

Unified Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2807363003: [Payments] After adding/editing a credit card, instrument is selected. (Closed)
Patch Set: include fix Created 3 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/ui/views/payments/credit_card_editor_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
index f6a49d8bdea44334659def7510f30467d8197dbc..d0c10544c923c7d38cb9b4ac70d623534cc5e6a3 100644
--- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
+++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
@@ -83,8 +83,12 @@ CreditCardEditorViewController::CreditCardEditorViewController(
PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog,
+ base::OnceClosure on_edited,
+ base::OnceCallback<void(const autofill::CreditCard&)> on_added,
autofill::CreditCard* credit_card)
: EditorViewController(spec, state, dialog),
+ on_edited_(std::move(on_edited)),
+ on_added_(std::move(on_added)),
credit_card_to_edit_(credit_card) {}
CreditCardEditorViewController::~CreditCardEditorViewController() {}
@@ -207,6 +211,7 @@ bool CreditCardEditorViewController::ValidateModelAndSave() {
if (!credit_card_to_edit_) {
// Add the card (will not add a duplicate).
state()->GetPersonalDataManager()->AddCreditCard(credit_card);
+ std::move(on_added_).Run(credit_card);
} else {
// We were in edit mode. Copy the data from the temporary object to retain
// the edited object's other properties (use count, use date, guid, etc.).
@@ -225,6 +230,7 @@ bool CreditCardEditorViewController::ValidateModelAndSave() {
locale);
}
state()->GetPersonalDataManager()->UpdateCreditCard(*credit_card_to_edit_);
+ std::move(on_edited_).Run();
}
return true;

Powered by Google App Engine
This is Rietveld 408576698