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 #include <string> | |
| 10 #include <vector> | |
| 9 | 11 |
| 10 #include "base/optional.h" | |
| 11 #include "components/payments/currency_formatter.h" | 12 #include "components/payments/currency_formatter.h" |
| 12 #include "components/payments/payment_request.mojom.h" | 13 #include "components/payments/payment_request.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 class CreditCard; | 17 class CreditCard; |
| 18 class AutofillProfile; | |
|
Mathieu
2017/01/18 21:34:16
nit: alphabetical
tmartino
2017/01/18 21:36:28
Done
| |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 class WebContents; | 22 class WebContents; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace payments { | 25 namespace payments { |
| 24 | 26 |
| 25 class PaymentRequestDelegate; | 27 class PaymentRequestDelegate; |
| 26 class PaymentRequestWebContentsManager; | 28 class PaymentRequestWebContentsManager; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 50 | 52 |
| 51 // Returns the CurrencyFormatter instance for this PaymentRequest. | 53 // Returns the CurrencyFormatter instance for this PaymentRequest. |
| 52 // |locale_name| should be the result of the browser's GetApplicationLocale(). | 54 // |locale_name| should be the result of the browser's GetApplicationLocale(). |
| 53 // Note: Having multiple currencies per PaymentRequest is not supported; hence | 55 // Note: Having multiple currencies per PaymentRequest is not supported; hence |
| 54 // the CurrencyFormatter is cached here. | 56 // the CurrencyFormatter is cached here. |
| 55 CurrencyFormatter* GetOrCreateCurrencyFormatter( | 57 CurrencyFormatter* GetOrCreateCurrencyFormatter( |
| 56 const std::string& currency_code, | 58 const std::string& currency_code, |
| 57 const base::Optional<std::string> currency_system, | 59 const base::Optional<std::string> currency_system, |
| 58 const std::string& locale_name); | 60 const std::string& locale_name); |
| 59 | 61 |
| 62 // Returns the Autofill Profile, representing the shipping address and contact | |
| 63 // information, currently selected for this PaymentRequest flow. If | |
| 64 // unpopulated, populates with and returns the 0th profile on record for this | |
| 65 // user, if it exists; or nullptr otherwise. Profile is owned by the request | |
| 66 // object, not the caller. | |
| 67 autofill::AutofillProfile* GetCurrentlySelectedProfile(); | |
| 68 | |
| 60 // Returns the currently selected credit card for this PaymentRequest flow. | 69 // Returns the currently selected credit card for this PaymentRequest flow. |
| 61 // It's not guaranteed to be complete. Returns nullptr if there is no selected | 70 // It's not guaranteed to be complete. Returns nullptr if there is no selected |
| 62 // card. | 71 // card. |
| 63 autofill::CreditCard* GetCurrentlySelectedCreditCard(); | 72 autofill::CreditCard* GetCurrentlySelectedCreditCard(); |
| 64 | 73 |
| 65 payments::mojom::PaymentDetails* details() { return details_.get(); } | 74 payments::mojom::PaymentDetails* details() { return details_.get(); } |
| 66 content::WebContents* web_contents() { return web_contents_; } | 75 content::WebContents* web_contents() { return web_contents_; } |
| 67 | 76 |
| 68 private: | 77 private: |
| 69 content::WebContents* web_contents_; | 78 content::WebContents* web_contents_; |
| 70 std::unique_ptr<PaymentRequestDelegate> delegate_; | 79 std::unique_ptr<PaymentRequestDelegate> delegate_; |
| 71 // |manager_| owns this PaymentRequest. | 80 // |manager_| owns this PaymentRequest. |
| 72 PaymentRequestWebContentsManager* manager_; | 81 PaymentRequestWebContentsManager* manager_; |
| 73 mojo::Binding<payments::mojom::PaymentRequest> binding_; | 82 mojo::Binding<payments::mojom::PaymentRequest> binding_; |
| 74 payments::mojom::PaymentRequestClientPtr client_; | 83 payments::mojom::PaymentRequestClientPtr client_; |
| 75 payments::mojom::PaymentDetailsPtr details_; | 84 payments::mojom::PaymentDetailsPtr details_; |
| 76 std::unique_ptr<CurrencyFormatter> currency_formatter_; | 85 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
| 86 std::unique_ptr<autofill::AutofillProfile> profile_; | |
| 77 | 87 |
| 78 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 88 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 79 }; | 89 }; |
| 80 | 90 |
| 81 } // namespace payments | 91 } // namespace payments |
| 82 | 92 |
| 83 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ | 93 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |