Chromium Code Reviews| Index: components/payments/content/payment_response_helper.h |
| diff --git a/components/payments/content/payment_response_helper.h b/components/payments/content/payment_response_helper.h |
| index 0912302ac5c2cfd3c0499bbb6750bae0e6b866a4..5e485831a579da75ab8bfeb358a919432cb8c04e 100644 |
| --- a/components/payments/content/payment_response_helper.h |
| +++ b/components/payments/content/payment_response_helper.h |
| @@ -7,6 +7,7 @@ |
| #include "base/macros.h" |
| #include "components/payments/content/payment_request.mojom.h" |
| +#include "components/payments/core/autofill_payment_instrument.h" |
|
Mathieu
2017/04/10 00:03:22
payment_instrument.h ?
sebsg
2017/04/10 20:48:24
Done.
|
| namespace autofill { |
| class AutofillProfile; |
| @@ -14,21 +15,47 @@ class AutofillProfile; |
| namespace payments { |
| -// TODO(sebsg): Accept PaymentInstrument and handle generating the payment |
| -// aspect of the PaymentResponse in this class. |
| +class PaymentRequestSpec; |
| + |
| // TODO(sebsg): Asynchronously normalize the billing and shipping addresses |
| // before adding them to the PaymentResponse. |
| // A helper class to facilitate the creation of the PaymentResponse. |
| -class PaymentResponseHelper { |
| +class PaymentResponseHelper : public PaymentInstrument::Delegate { |
| public: |
| - PaymentResponseHelper(); |
| - ~PaymentResponseHelper(); |
| + class Delegate { |
| + public: |
| + virtual ~Delegate() {} |
| + |
| + virtual void OnPaymentResponseReady( |
| + mojom::PaymentResponsePtr payment_response) = 0; |
| + }; |
| + |
| + PaymentResponseHelper(const std::string& app_locale, |
|
Mathieu
2017/04/10 00:03:22
Mention that |delegate| can't be nullptr, but sele
sebsg
2017/04/10 20:48:25
Done.
|
| + PaymentRequestSpec* spec, |
| + autofill::AutofillProfile* selected_shipping_profile, |
| + autofill::AutofillProfile* selected_contact_profile, |
| + Delegate* delegate); |
| + ~PaymentResponseHelper() override; |
| static mojom::PaymentAddressPtr GetMojomPaymentAddressFromAutofillProfile( |
|
Mathieu
2017/04/10 00:03:22
Let's add a function comment
sebsg
2017/04/10 20:48:25
Done.
|
| const autofill::AutofillProfile* const profile, |
| const std::string& app_locale); |
| + // PaymentInstrument::Delegate |
| + void OnInstrumentDetailsReady( |
| + const std::string& method_name, |
| + const std::string& stringified_details) override; |
| + void OnInstrumentDetailsError() override {} |
| + |
| private: |
| + const std::string app_locale_; |
|
Mathieu
2017/04/10 00:03:22
nit: could keep as a const std::string&
sebsg
2017/04/10 20:48:25
Done.
|
| + |
| + // Not owned. Never null. All outlive this object. |
|
Mathieu
2017/04/10 00:03:22
actually the profiles can be null?
sebsg
2017/04/10 20:48:25
Done.
|
| + PaymentRequestSpec* spec_; |
| + autofill::AutofillProfile* selected_shipping_profile_; |
| + autofill::AutofillProfile* selected_contact_profile_; |
| + Delegate* delegate_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(PaymentResponseHelper); |
| }; |