| 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..c8903e22b92dd8ae2c8f0ba7ee490db7f7e4eeeb 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/payment_instrument.h"
|
|
|
| namespace autofill {
|
| class AutofillProfile;
|
| @@ -14,21 +15,54 @@ 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;
|
| + };
|
|
|
| + // The spec, selected_instrument and delegate cannot be null.
|
| + PaymentResponseHelper(const std::string& app_locale,
|
| + PaymentRequestSpec* spec,
|
| + PaymentInstrument* selected_instrument,
|
| + autofill::AutofillProfile* selected_shipping_profile,
|
| + autofill::AutofillProfile* selected_contact_profile,
|
| + Delegate* delegate);
|
| + ~PaymentResponseHelper() override;
|
| +
|
| + // Returns a new mojo PaymentAddress based on the specified
|
| + // |profile| and |app_locale|.
|
| static mojom::PaymentAddressPtr GetMojomPaymentAddressFromAutofillProfile(
|
| 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_;
|
| +
|
| + // Not owned, cannot be null.
|
| + PaymentRequestSpec* spec_;
|
| + Delegate* delegate_;
|
| + PaymentInstrument* selected_instrument_;
|
| +
|
| + // Not owned, can be null (dependent on the spec).
|
| + autofill::AutofillProfile* selected_shipping_profile_;
|
| + autofill::AutofillProfile* selected_contact_profile_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(PaymentResponseHelper);
|
| };
|
|
|
|
|