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" | 12 #include "base/optional.h" |
| 13 #include "components/autofill/core/browser/autofill_profile.h" | |
|
please use gerrit instead
2017/01/18 18:50:48
Please forward-declare instead
tmartino
2017/01/18 20:39:13
Done
| |
| 11 #include "components/payments/currency_formatter.h" | 14 #include "components/payments/currency_formatter.h" |
| 12 #include "components/payments/payment_request.mojom.h" | 15 #include "components/payments/payment_request.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 14 | 17 |
| 15 namespace autofill { | 18 namespace autofill { |
| 16 class CreditCard; | 19 class CreditCard; |
| 17 } | 20 } |
| 18 | 21 |
| 19 namespace content { | 22 namespace content { |
| 20 class WebContents; | 23 class WebContents; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 50 | 53 |
| 51 // Returns the CurrencyFormatter instance for this PaymentRequest. | 54 // Returns the CurrencyFormatter instance for this PaymentRequest. |
| 52 // |locale_name| should be the result of the browser's GetApplicationLocale(). | 55 // |locale_name| should be the result of the browser's GetApplicationLocale(). |
| 53 // Note: Having multiple currencies per PaymentRequest is not supported; hence | 56 // Note: Having multiple currencies per PaymentRequest is not supported; hence |
| 54 // the CurrencyFormatter is cached here. | 57 // the CurrencyFormatter is cached here. |
| 55 CurrencyFormatter* GetOrCreateCurrencyFormatter( | 58 CurrencyFormatter* GetOrCreateCurrencyFormatter( |
| 56 const std::string& currency_code, | 59 const std::string& currency_code, |
| 57 const base::Optional<std::string> currency_system, | 60 const base::Optional<std::string> currency_system, |
| 58 const std::string& locale_name); | 61 const std::string& locale_name); |
| 59 | 62 |
| 63 autofill::AutofillProfile* GetCurrentlySelectedProfile(); | |
| 64 | |
| 60 // Returns the currently selected credit card for this PaymentRequest flow. | 65 // 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 | 66 // It's not guaranteed to be complete. Returns nullptr if there is no selected |
| 62 // card. | 67 // card. |
| 63 autofill::CreditCard* GetCurrentlySelectedCreditCard(); | 68 autofill::CreditCard* GetCurrentlySelectedCreditCard(); |
| 64 | 69 |
| 65 payments::mojom::PaymentDetails* details() { return details_.get(); } | 70 payments::mojom::PaymentDetails* details() { return details_.get(); } |
| 66 content::WebContents* web_contents() { return web_contents_; } | 71 content::WebContents* web_contents() { return web_contents_; } |
| 67 | 72 |
| 68 private: | 73 private: |
| 69 content::WebContents* web_contents_; | 74 content::WebContents* web_contents_; |
| 70 std::unique_ptr<PaymentRequestDelegate> delegate_; | 75 std::unique_ptr<PaymentRequestDelegate> delegate_; |
| 71 // |manager_| owns this PaymentRequest. | 76 // |manager_| owns this PaymentRequest. |
| 72 PaymentRequestWebContentsManager* manager_; | 77 PaymentRequestWebContentsManager* manager_; |
| 73 mojo::Binding<payments::mojom::PaymentRequest> binding_; | 78 mojo::Binding<payments::mojom::PaymentRequest> binding_; |
| 74 payments::mojom::PaymentRequestClientPtr client_; | 79 payments::mojom::PaymentRequestClientPtr client_; |
| 75 payments::mojom::PaymentDetailsPtr details_; | 80 payments::mojom::PaymentDetailsPtr details_; |
| 76 std::unique_ptr<CurrencyFormatter> currency_formatter_; | 81 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
| 82 base::Optional<autofill::AutofillProfile*> profile_; | |
|
please use gerrit instead
2017/01/18 18:50:48
Please keep a copy of the selected profile. Profil
tmartino
2017/01/18 20:39:13
Done
| |
| 77 | 83 |
| 78 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 84 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 } // namespace payments | 87 } // namespace payments |
| 82 | 88 |
| 83 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ | 89 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |