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

Side by Side Diff: components/payments/content/payment_request.h

Issue 2775193004: [Payments] Have an observer for canMakePayment, for testing. (Closed)
Patch Set: addressed comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 // This class manages the interaction between the renderer (through the 27 // This class manages the interaction between the renderer (through the
28 // PaymentRequestClient and Mojo stub implementation) and the UI (through the 28 // PaymentRequestClient and Mojo stub implementation) and the UI (through the
29 // PaymentRequestDelegate). The API user (merchant) specification (supported 29 // PaymentRequestDelegate). The API user (merchant) specification (supported
30 // payment methods, required information, order details) is stored in 30 // payment methods, required information, order details) is stored in
31 // PaymentRequestSpec, and the current user selection state (and related data) 31 // PaymentRequestSpec, and the current user selection state (and related data)
32 // is stored in PaymentRequestSpec. 32 // is stored in PaymentRequestSpec.
33 class PaymentRequest : public mojom::PaymentRequest, 33 class PaymentRequest : public mojom::PaymentRequest,
34 public PaymentRequestSpec::Observer, 34 public PaymentRequestSpec::Observer,
35 public PaymentRequestState::Delegate { 35 public PaymentRequestState::Delegate {
36 public: 36 public:
37 class ObserverForTest {
38 public:
39 virtual void OnCanMakePaymentCalled() = 0;
40
41 protected:
42 virtual ~ObserverForTest() {}
43 };
44
37 PaymentRequest(content::WebContents* web_contents, 45 PaymentRequest(content::WebContents* web_contents,
38 std::unique_ptr<PaymentRequestDelegate> delegate, 46 std::unique_ptr<PaymentRequestDelegate> delegate,
39 PaymentRequestWebContentsManager* manager, 47 PaymentRequestWebContentsManager* manager,
40 mojo::InterfaceRequest<mojom::PaymentRequest> request); 48 mojo::InterfaceRequest<mojom::PaymentRequest> request,
49 ObserverForTest* observer_for_testing);
41 ~PaymentRequest() override; 50 ~PaymentRequest() override;
42 51
43 // mojom::PaymentRequest 52 // mojom::PaymentRequest
44 void Init(mojom::PaymentRequestClientPtr client, 53 void Init(mojom::PaymentRequestClientPtr client,
45 std::vector<mojom::PaymentMethodDataPtr> method_data, 54 std::vector<mojom::PaymentMethodDataPtr> method_data,
46 mojom::PaymentDetailsPtr details, 55 mojom::PaymentDetailsPtr details,
47 mojom::PaymentOptionsPtr options) override; 56 mojom::PaymentOptionsPtr options) override;
48 void Show() override; 57 void Show() override;
49 void UpdateWith(mojom::PaymentDetailsPtr details) override {} 58 void UpdateWith(mojom::PaymentDetailsPtr details) override {}
50 void Abort() override; 59 void Abort() override;
(...skipping 29 matching lines...) Expand all
80 content::WebContents* web_contents_; 89 content::WebContents* web_contents_;
81 std::unique_ptr<PaymentRequestDelegate> delegate_; 90 std::unique_ptr<PaymentRequestDelegate> delegate_;
82 // |manager_| owns this PaymentRequest. 91 // |manager_| owns this PaymentRequest.
83 PaymentRequestWebContentsManager* manager_; 92 PaymentRequestWebContentsManager* manager_;
84 mojo::Binding<mojom::PaymentRequest> binding_; 93 mojo::Binding<mojom::PaymentRequest> binding_;
85 mojom::PaymentRequestClientPtr client_; 94 mojom::PaymentRequestClientPtr client_;
86 95
87 std::unique_ptr<PaymentRequestSpec> spec_; 96 std::unique_ptr<PaymentRequestSpec> spec_;
88 std::unique_ptr<PaymentRequestState> state_; 97 std::unique_ptr<PaymentRequestState> state_;
89 98
99 // May be null, must outlive this object.
100 ObserverForTest* observer_for_testing_;
101
90 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 102 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
91 }; 103 };
92 104
93 } // namespace payments 105 } // namespace payments
94 106
95 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 107 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698