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

Unified Diff: components/payments/content/payment_request_state.h

Issue 2808633002: [Payments] Move PaymentResponse logic to PaymentResponseHelper. (Closed)
Patch Set: 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: components/payments/content/payment_request_state.h
diff --git a/components/payments/content/payment_request_state.h b/components/payments/content/payment_request_state.h
index f1d067bbeac2251eea2664d19b9d3f572a02b0c1..2a883124592b2fb980a96dc3b94cbdd9fe56db71 100644
--- a/components/payments/content/payment_request_state.h
+++ b/components/payments/content/payment_request_state.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "components/payments/content/payment_request.mojom.h"
+#include "components/payments/content/payment_response_helper.h"
#include "components/payments/core/autofill_payment_instrument.h"
#include "components/payments/core/payment_instrument.h"
@@ -28,7 +29,7 @@ class PaymentRequestSpec;
// user is ready to pay. Uses information from the PaymentRequestSpec, which is
// what the merchant has specified, as input into the "is ready to pay"
// computation.
-class PaymentRequestState : public PaymentInstrument::Delegate {
+class PaymentRequestState : public PaymentResponseHelper::Delegate {
public:
// Any class call add itself as Observer via AddObserver() and receive
// notification about the state changing.
@@ -66,18 +67,16 @@ class PaymentRequestState : public PaymentInstrument::Delegate {
PaymentRequestDelegate* payment_request_delegate);
~PaymentRequestState() override;
+ // PaymentResponseHelper::Delegate
+ void OnPaymentResponseReady(
+ mojom::PaymentResponsePtr payment_response) override;
+
// Returns whether the user has at least one instrument that satisfies the
// specified supported payment methods.
bool CanMakePayment() const;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
- // PaymentInstrument::Delegate:
- void OnInstrumentDetailsReady(
- const std::string& method_name,
- const std::string& stringified_details) override;
- void OnInstrumentDetailsError() override {}
-
// Initiates the generation of the PaymentResponse. Callers should check
// |is_ready_to_pay|, which is inexpensive.
void GeneratePaymentResponse();
@@ -174,6 +173,8 @@ class PaymentRequestState : public PaymentInstrument::Delegate {
PaymentRequestDelegate* payment_request_delegate_;
+ std::unique_ptr<PaymentResponseHelper> response_helper_;
+
base::ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(PaymentRequestState);

Powered by Google App Engine
This is Rietveld 408576698