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

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

Issue 2775193004: [Payments] Have an observer for canMakePayment, for testing. (Closed)
Patch Set: Initial 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;
please use gerrit instead 2017/03/27 18:12:32 Need a virtual empty destructor.
Mathieu 2017/03/27 18:28:24 Done.
40 };
41
37 PaymentRequest(content::WebContents* web_contents, 42 PaymentRequest(content::WebContents* web_contents,
38 std::unique_ptr<PaymentRequestDelegate> delegate, 43 std::unique_ptr<PaymentRequestDelegate> delegate,
39 PaymentRequestWebContentsManager* manager, 44 PaymentRequestWebContentsManager* manager,
40 mojo::InterfaceRequest<mojom::PaymentRequest> request); 45 mojo::InterfaceRequest<mojom::PaymentRequest> request,
46 ObserverForTest* observer_for_testing);
41 ~PaymentRequest() override; 47 ~PaymentRequest() override;
42 48
43 // mojom::PaymentRequest 49 // mojom::PaymentRequest
44 void Init(mojom::PaymentRequestClientPtr client, 50 void Init(mojom::PaymentRequestClientPtr client,
45 std::vector<mojom::PaymentMethodDataPtr> method_data, 51 std::vector<mojom::PaymentMethodDataPtr> method_data,
46 mojom::PaymentDetailsPtr details, 52 mojom::PaymentDetailsPtr details,
47 mojom::PaymentOptionsPtr options) override; 53 mojom::PaymentOptionsPtr options) override;
48 void Show() override; 54 void Show() override;
49 void UpdateWith(mojom::PaymentDetailsPtr details) override {} 55 void UpdateWith(mojom::PaymentDetailsPtr details) override {}
50 void Abort() override; 56 void Abort() override;
(...skipping 29 matching lines...) Expand all
80 content::WebContents* web_contents_; 86 content::WebContents* web_contents_;
81 std::unique_ptr<PaymentRequestDelegate> delegate_; 87 std::unique_ptr<PaymentRequestDelegate> delegate_;
82 // |manager_| owns this PaymentRequest. 88 // |manager_| owns this PaymentRequest.
83 PaymentRequestWebContentsManager* manager_; 89 PaymentRequestWebContentsManager* manager_;
84 mojo::Binding<mojom::PaymentRequest> binding_; 90 mojo::Binding<mojom::PaymentRequest> binding_;
85 mojom::PaymentRequestClientPtr client_; 91 mojom::PaymentRequestClientPtr client_;
86 92
87 std::unique_ptr<PaymentRequestSpec> spec_; 93 std::unique_ptr<PaymentRequestSpec> spec_;
88 std::unique_ptr<PaymentRequestState> state_; 94 std::unique_ptr<PaymentRequestState> state_;
89 95
96 // May be null.
please use gerrit instead 2017/03/27 18:12:32 , must outlive this object.
Mathieu 2017/03/27 18:28:24 Done.
97 ObserverForTest* observer_for_testing_;
98
90 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 99 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
91 }; 100 };
92 101
93 } // namespace payments 102 } // namespace payments
94 103
95 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 104 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698