| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); | 36 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); |
| 37 ~PaymentRequest() override; | 37 ~PaymentRequest() override; |
| 38 | 38 |
| 39 // payments::mojom::PaymentRequest "stub" | 39 // payments::mojom::PaymentRequest "stub" |
| 40 void Init(payments::mojom::PaymentRequestClientPtr client, | 40 void Init(payments::mojom::PaymentRequestClientPtr client, |
| 41 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, | 41 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, |
| 42 payments::mojom::PaymentDetailsPtr details, | 42 payments::mojom::PaymentDetailsPtr details, |
| 43 payments::mojom::PaymentOptionsPtr options) override; | 43 payments::mojom::PaymentOptionsPtr options) override; |
| 44 void Show() override; | 44 void Show() override; |
| 45 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} | 45 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} |
| 46 void Abort() override {} | 46 void Abort() override; |
| 47 void Complete(payments::mojom::PaymentComplete result) override {} | 47 void Complete(payments::mojom::PaymentComplete result) override {} |
| 48 void CanMakePayment() override {} | 48 void CanMakePayment() override {} |
| 49 | 49 |
| 50 void Cancel(); | 50 // Called when the user explicitely cancelled the flow. Will send a message |
| 51 void OnError(); | 51 // to the renderer which will indirectly destroy this object (through |
| 52 // OnConnectionTerminated). |
| 53 void UserCancelled(); |
| 54 |
| 55 // As a result of a browser-side error or renderer-initiated mojo channel |
| 56 // closure (e.g. there was an error on the renderer side, or payment was |
| 57 // successful), this method is called. It is responsible for cleaning up, |
| 58 // such as possibly closing the dialog. |
| 59 void OnConnectionTerminated(); |
| 52 | 60 |
| 53 // Returns the CurrencyFormatter instance for this PaymentRequest. | 61 // Returns the CurrencyFormatter instance for this PaymentRequest. |
| 54 // |locale_name| should be the result of the browser's GetApplicationLocale(). | 62 // |locale_name| should be the result of the browser's GetApplicationLocale(). |
| 55 // Note: Having multiple currencies per PaymentRequest is not supported; hence | 63 // Note: Having multiple currencies per PaymentRequest is not supported; hence |
| 56 // the CurrencyFormatter is cached here. | 64 // the CurrencyFormatter is cached here. |
| 57 CurrencyFormatter* GetOrCreateCurrencyFormatter( | 65 CurrencyFormatter* GetOrCreateCurrencyFormatter( |
| 58 const std::string& currency_code, | 66 const std::string& currency_code, |
| 59 const base::Optional<std::string> currency_system, | 67 const base::Optional<std::string> currency_system, |
| 60 const std::string& locale_name); | 68 const std::string& locale_name); |
| 61 | 69 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 84 payments::mojom::PaymentDetailsPtr details_; | 92 payments::mojom::PaymentDetailsPtr details_; |
| 85 std::unique_ptr<CurrencyFormatter> currency_formatter_; | 93 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
| 86 std::unique_ptr<autofill::AutofillProfile> profile_; | 94 std::unique_ptr<autofill::AutofillProfile> profile_; |
| 87 | 95 |
| 88 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 96 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 89 }; | 97 }; |
| 90 | 98 |
| 91 } // namespace payments | 99 } // namespace payments |
| 92 | 100 |
| 93 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ | 101 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |