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

Unified Diff: chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h

Issue 2841643002: When a new Payments address is created from the editor, use it as the chosen address (Closed)
Patch Set: And yet another small goof 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/shipping_address_editor_view_controller.h
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h
index 05018d49716fd1518a13bf14ce6a3a6176319b92..3a2f8a92d6ab449277be9adf6c0a9afb412e1768 100644
--- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h
+++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.h
@@ -27,11 +27,18 @@ class PaymentRequestDialogView;
// Shipping Address editor screen of the Payment Request flow.
class ShippingAddressEditorViewController : public EditorViewController {
public:
- // Does not take ownership of the arguments, which should outlive this object.
- ShippingAddressEditorViewController(PaymentRequestSpec* spec,
- PaymentRequestState* state,
- PaymentRequestDialogView* dialog,
- autofill::AutofillProfile* profile);
+ // Does not take ownership of the arguments (except for the |on_edited| and
+ // |on_added| callbacks), which should outlive this object. Additionally,
+ // |profile| could be nullptr if we are adding a new shipping address. Else,
+ // it's a valid pointer to a card that needs to be updated, and which will
+ // outlive this controller.
+ ShippingAddressEditorViewController(
+ PaymentRequestSpec* spec,
+ PaymentRequestState* state,
+ PaymentRequestDialogView* dialog,
+ base::OnceClosure on_edited,
+ base::OnceCallback<void(const autofill::AutofillProfile&)> on_added,
+ autofill::AutofillProfile* profile);
~ShippingAddressEditorViewController() override;
// EditorViewController:
@@ -75,6 +82,12 @@ class ShippingAddressEditorViewController : public EditorViewController {
};
friend class ShippingAddressValidationDelegate;
+ // Called when |profile_to_edit_| was successfully edited.
+ base::OnceClosure on_edited_;
+ // Called when a new profile was added. The const reference is short-lived,
+ // and the callee should make a copy.
+ base::OnceCallback<void(const autofill::AutofillProfile&)> on_added_;
+
// If non-nullptr, a point to an object to be edited, which should outlive
// this controller.
autofill::AutofillProfile* profile_to_edit_;

Powered by Google App Engine
This is Rietveld 408576698