Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_PAYMENT_REQUEST_H_ | 5 #ifndef COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| 6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ | 6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "components/payments/payment_request.mojom.h" | 10 #include "components/payments/payment_request.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 12 | 12 |
| 13 namespace autofill { | |
| 14 class CreditCard; | |
| 15 } | |
| 16 | |
| 13 namespace content { | 17 namespace content { |
| 14 class WebContents; | 18 class WebContents; |
| 15 } | 19 } |
| 16 | 20 |
| 17 namespace payments { | 21 namespace payments { |
| 18 | 22 |
| 19 class PaymentRequestDelegate; | 23 class PaymentRequestDelegate; |
| 20 class PaymentRequestWebContentsManager; | 24 class PaymentRequestWebContentsManager; |
| 21 | 25 |
| 22 class PaymentRequest : payments::mojom::PaymentRequest { | 26 class PaymentRequest : payments::mojom::PaymentRequest { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 34 payments::mojom::PaymentDetailsPtr details, | 38 payments::mojom::PaymentDetailsPtr details, |
| 35 payments::mojom::PaymentOptionsPtr options) override; | 39 payments::mojom::PaymentOptionsPtr options) override; |
| 36 void Show() override; | 40 void Show() override; |
| 37 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} | 41 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} |
| 38 void Abort() override {} | 42 void Abort() override {} |
| 39 void Complete(payments::mojom::PaymentComplete result) override {} | 43 void Complete(payments::mojom::PaymentComplete result) override {} |
| 40 void CanMakePayment() override {} | 44 void CanMakePayment() override {} |
| 41 | 45 |
| 42 void Cancel(); | 46 void Cancel(); |
| 43 void OnError(); | 47 void OnError(); |
| 48 | |
| 49 // Returns the currently selected credit card for this PaymentRequest flow. | |
| 50 // It's not guaranteed to be complete. | |
| 51 // Returns nullptr if there is no selected card. | |
|
Mathieu
2017/01/12 21:27:11
wrap lines
anthonyvd
2017/01/13 16:09:19
Done.
| |
| 52 autofill::CreditCard* GetCurrentlySelectedCreditCard(); | |
| 53 | |
| 44 payments::mojom::PaymentDetails* details() { return details_.get(); } | 54 payments::mojom::PaymentDetails* details() { return details_.get(); } |
| 45 | |
| 46 content::WebContents* web_contents() { return web_contents_; } | 55 content::WebContents* web_contents() { return web_contents_; } |
| 47 | 56 |
| 48 private: | 57 private: |
| 49 content::WebContents* web_contents_; | 58 content::WebContents* web_contents_; |
| 50 std::unique_ptr<PaymentRequestDelegate> delegate_; | 59 std::unique_ptr<PaymentRequestDelegate> delegate_; |
| 51 // |manager_| owns this PaymentRequest. | 60 // |manager_| owns this PaymentRequest. |
| 52 PaymentRequestWebContentsManager* manager_; | 61 PaymentRequestWebContentsManager* manager_; |
| 53 mojo::Binding<payments::mojom::PaymentRequest> binding_; | 62 mojo::Binding<payments::mojom::PaymentRequest> binding_; |
| 54 payments::mojom::PaymentRequestClientPtr client_; | 63 payments::mojom::PaymentRequestClientPtr client_; |
| 55 payments::mojom::PaymentDetailsPtr details_; | 64 payments::mojom::PaymentDetailsPtr details_; |
| 56 | 65 |
| 57 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 66 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 58 }; | 67 }; |
| 59 | 68 |
| 60 } // namespace payments | 69 } // namespace payments |
| 61 | 70 |
| 62 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ | 71 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |