Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SPEC_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| 7 | 7 |
| 8 #include <set> | |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 13 #include "components/payments/content/payment_request.mojom.h" | 14 #include "components/payments/content/payment_request.mojom.h" |
| 14 #include "components/payments/core/currency_formatter.h" | 15 #include "components/payments/core/currency_formatter.h" |
| 15 | 16 |
| 16 namespace payments { | 17 namespace payments { |
| 17 | 18 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 42 void RemoveObserver(Observer* observer); | 43 void RemoveObserver(Observer* observer); |
| 43 | 44 |
| 44 bool request_shipping() const { return options_->request_shipping; } | 45 bool request_shipping() const { return options_->request_shipping; } |
| 45 bool request_payer_name() const { return options_->request_payer_name; } | 46 bool request_payer_name() const { return options_->request_payer_name; } |
| 46 bool request_payer_phone() const { return options_->request_payer_phone; } | 47 bool request_payer_phone() const { return options_->request_payer_phone; } |
| 47 bool request_payer_email() const { return options_->request_payer_email; } | 48 bool request_payer_email() const { return options_->request_payer_email; } |
| 48 | 49 |
| 49 const std::vector<std::string>& supported_card_networks() { | 50 const std::vector<std::string>& supported_card_networks() { |
| 50 return supported_card_networks_; | 51 return supported_card_networks_; |
| 51 } | 52 } |
| 53 const std::set<std::string>& supported_card_networks_set() { | |
| 54 return supported_card_networks_set_; | |
| 55 } | |
| 52 | 56 |
| 53 // Uses CurrencyFormatter to format |amount| with the currency symbol for this | 57 // Uses CurrencyFormatter to format |amount| with the currency symbol for this |
| 54 // request's currency. Will use currency of the "total" display item, because | 58 // request's currency. Will use currency of the "total" display item, because |
| 55 // all items are supposed to have the same currency in a given request. | 59 // all items are supposed to have the same currency in a given request. |
| 56 base::string16 GetFormattedCurrencyAmount(const std::string& amount); | 60 base::string16 GetFormattedCurrencyAmount(const std::string& amount); |
| 57 | 61 |
| 58 // Uses CurrencyFormatter to get the formatted currency code for this | 62 // Uses CurrencyFormatter to get the formatted currency code for this |
| 59 // request's currency. Will use currency of the "total" display item, because | 63 // request's currency. Will use currency of the "total" display item, because |
| 60 // all items are supposed to have the same currency in a given request. | 64 // all items are supposed to have the same currency in a given request. |
| 61 std::string GetFormattedCurrencyCode(); | 65 std::string GetFormattedCurrencyCode(); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 78 CurrencyFormatter* GetOrCreateCurrencyFormatter( | 82 CurrencyFormatter* GetOrCreateCurrencyFormatter( |
| 79 const std::string& currency_code, | 83 const std::string& currency_code, |
| 80 const std::string& currency_system, | 84 const std::string& currency_system, |
| 81 const std::string& locale_name); | 85 const std::string& locale_name); |
| 82 | 86 |
| 83 mojom::PaymentOptionsPtr options_; | 87 mojom::PaymentOptionsPtr options_; |
| 84 mojom::PaymentDetailsPtr details_; | 88 mojom::PaymentDetailsPtr details_; |
| 85 const std::string app_locale_; | 89 const std::string app_locale_; |
| 86 std::unique_ptr<CurrencyFormatter> currency_formatter_; | 90 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
| 87 | 91 |
| 88 // A list of supported basic card networks, in order that they were specified | 92 // A list/set of supported basic card networks. The list is used to keep the |
| 89 // by the merchant. | 93 // order in which they were specified by the merchant. The set is used for |
| 94 // fast lookup of supported methods. | |
| 90 std::vector<std::string> supported_card_networks_; | 95 std::vector<std::string> supported_card_networks_; |
| 96 std::set<std::string> supported_card_networks_set_; | |
|
Mathieu
2017/03/16 02:50:03
this I'm not sure about. It's used in PaymentReque
please use gerrit instead
2017/03/16 14:27:02
This is OK.
| |
| 91 | 97 |
| 92 base::ObserverList<Observer> observers_; | 98 base::ObserverList<Observer> observers_; |
| 93 | 99 |
| 94 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); | 100 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); |
| 95 }; | 101 }; |
| 96 | 102 |
| 97 } // namespace payments | 103 } // namespace payments |
| 98 | 104 |
| 99 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 105 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| OLD | NEW |