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

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

Issue 2866623003: PaymentRequest.canMakePayment() query quota on desktop. (Closed)
Patch Set: frame Created 3 years, 7 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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/payments/content/payment_request_spec.h" 12 #include "components/payments/content/payment_request_spec.h"
13 #include "components/payments/content/payment_request_state.h" 13 #include "components/payments/content/payment_request_state.h"
14 #include "components/payments/core/journey_logger.h" 14 #include "components/payments/core/journey_logger.h"
15 #include "components/payments/core/payment_request_delegate.h" 15 #include "components/payments/core/payment_request_delegate.h"
16 #include "components/payments/mojom/payment_request.mojom.h" 16 #include "components/payments/mojom/payment_request.mojom.h"
17 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
18 #include "mojo/public/cpp/bindings/interface_request.h" 18 #include "mojo/public/cpp/bindings/interface_request.h"
19 #include "url/gurl.h"
19 20
20 namespace content { 21 namespace content {
22 class RenderFrameHost;
21 class WebContents; 23 class WebContents;
22 } 24 }
23 25
24 namespace payments { 26 namespace payments {
25 27
26 class PaymentRequestWebContentsManager; 28 class PaymentRequestWebContentsManager;
27 29
28 // This class manages the interaction between the renderer (through the 30 // This class manages the interaction between the renderer (through the
29 // PaymentRequestClient and Mojo stub implementation) and the UI (through the 31 // PaymentRequestClient and Mojo stub implementation) and the UI (through the
30 // PaymentRequestDelegate). The API user (merchant) specification (supported 32 // PaymentRequestDelegate). The API user (merchant) specification (supported
31 // payment methods, required information, order details) is stored in 33 // payment methods, required information, order details) is stored in
32 // PaymentRequestSpec, and the current user selection state (and related data) 34 // PaymentRequestSpec, and the current user selection state (and related data)
33 // is stored in PaymentRequestSpec. 35 // is stored in PaymentRequestSpec.
34 class PaymentRequest : public mojom::PaymentRequest, 36 class PaymentRequest : public mojom::PaymentRequest,
35 public PaymentRequestSpec::Observer, 37 public PaymentRequestSpec::Observer,
36 public PaymentRequestState::Delegate { 38 public PaymentRequestState::Delegate {
37 public: 39 public:
38 class ObserverForTest { 40 class ObserverForTest {
39 public: 41 public:
40 virtual void OnCanMakePaymentCalled() = 0; 42 virtual void OnCanMakePaymentCalled() = 0;
41 virtual void OnNotSupportedError() = 0; 43 virtual void OnNotSupportedError() = 0;
42 virtual void OnConnectionTerminated() = 0; 44 virtual void OnConnectionTerminated() = 0;
43 45
44 protected: 46 protected:
45 virtual ~ObserverForTest() {} 47 virtual ~ObserverForTest() {}
46 }; 48 };
47 49
48 PaymentRequest(content::WebContents* web_contents, 50 PaymentRequest(content::RenderFrameHost* render_frame_host,
51 content::WebContents* web_contents,
49 std::unique_ptr<PaymentRequestDelegate> delegate, 52 std::unique_ptr<PaymentRequestDelegate> delegate,
50 PaymentRequestWebContentsManager* manager, 53 PaymentRequestWebContentsManager* manager,
51 mojo::InterfaceRequest<mojom::PaymentRequest> request, 54 mojo::InterfaceRequest<mojom::PaymentRequest> request,
52 ObserverForTest* observer_for_testing); 55 ObserverForTest* observer_for_testing);
53 ~PaymentRequest() override; 56 ~PaymentRequest() override;
54 57
55 // mojom::PaymentRequest 58 // mojom::PaymentRequest
56 void Init(mojom::PaymentRequestClientPtr client, 59 void Init(mojom::PaymentRequestClientPtr client,
57 std::vector<mojom::PaymentMethodDataPtr> method_data, 60 std::vector<mojom::PaymentMethodDataPtr> method_data,
58 mojom::PaymentDetailsPtr details, 61 mojom::PaymentDetailsPtr details,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 content::WebContents* web_contents_; 97 content::WebContents* web_contents_;
95 std::unique_ptr<PaymentRequestDelegate> delegate_; 98 std::unique_ptr<PaymentRequestDelegate> delegate_;
96 // |manager_| owns this PaymentRequest. 99 // |manager_| owns this PaymentRequest.
97 PaymentRequestWebContentsManager* manager_; 100 PaymentRequestWebContentsManager* manager_;
98 mojo::Binding<mojom::PaymentRequest> binding_; 101 mojo::Binding<mojom::PaymentRequest> binding_;
99 mojom::PaymentRequestClientPtr client_; 102 mojom::PaymentRequestClientPtr client_;
100 103
101 std::unique_ptr<PaymentRequestSpec> spec_; 104 std::unique_ptr<PaymentRequestSpec> spec_;
102 std::unique_ptr<PaymentRequestState> state_; 105 std::unique_ptr<PaymentRequestState> state_;
103 106
107 // The RFC 6454 origin of the frame that has invoked PaymentRequest API. This
108 // can be either the main frame or an iframe.
109 const GURL frame_origin_;
110
104 // May be null, must outlive this object. 111 // May be null, must outlive this object.
105 ObserverForTest* observer_for_testing_; 112 ObserverForTest* observer_for_testing_;
106 113
107 JourneyLogger journey_logger_; 114 JourneyLogger journey_logger_;
108 115
109 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 116 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
110 }; 117 };
111 118
112 } // namespace payments 119 } // namespace payments
113 120
114 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 121 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
OLDNEW
« no previous file with comments | « components/payments/content/can_make_payment_query_factory.cc ('k') | components/payments/content/payment_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698