| 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 IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void set_selected_contact_profile(autofill::AutofillProfile* profile) { | 87 void set_selected_contact_profile(autofill::AutofillProfile* profile) { |
| 88 selected_contact_profile_ = profile; | 88 selected_contact_profile_ = profile; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Returns the available autofill profiles for this user to be used as | 91 // Returns the available autofill profiles for this user to be used as |
| 92 // billing profiles. | 92 // billing profiles. |
| 93 const std::vector<autofill::AutofillProfile*>& billing_profiles() const { | 93 const std::vector<autofill::AutofillProfile*>& billing_profiles() const { |
| 94 return shipping_profiles_; | 94 return shipping_profiles_; |
| 95 } | 95 } |
| 96 | 96 |
| 97 const std::vector<std::string>& supported_card_networks() const { |
| 98 return supported_card_networks_; |
| 99 } |
| 100 |
| 101 // Adds |credit_card| to the list of cached credit cards. |
| 102 void AddCreditCard(std::unique_ptr<autofill::CreditCard> credit_card); |
| 103 |
| 97 // Returns the available autofill credit cards for this user that match a | 104 // Returns the available autofill credit cards for this user that match a |
| 98 // supported type specified in |web_payment_request_|. | 105 // supported type specified in |web_payment_request_|. |
| 99 const std::vector<autofill::CreditCard*>& credit_cards() const { | 106 const std::vector<autofill::CreditCard*>& credit_cards() const { |
| 100 return credit_cards_; | 107 return credit_cards_; |
| 101 } | 108 } |
| 102 | 109 |
| 103 // Returns the currently selected credit card for this PaymentRequest flow if | 110 // Returns the currently selected credit card for this PaymentRequest flow if |
| 104 // there is one. Returns nullptr if there is no selected credit card. | 111 // there is one. Returns nullptr if there is no selected credit card. |
| 105 autofill::CreditCard* selected_credit_card() const { | 112 autofill::CreditCard* selected_credit_card() const { |
| 106 return selected_credit_card_; | 113 return selected_credit_card_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 167 |
| 161 // Credit cards returnd by the Data Manager may change due to (e.g.) | 168 // Credit cards returnd by the Data Manager may change due to (e.g.) |
| 162 // sync events, meaning PaymentRequest may outlive them. Therefore, credit | 169 // sync events, meaning PaymentRequest may outlive them. Therefore, credit |
| 163 // cards are fetched once and owned here. Whenever credit cards are requested | 170 // cards are fetched once and owned here. Whenever credit cards are requested |
| 164 // a vector of pointers to these copies are returned. | 171 // a vector of pointers to these copies are returned. |
| 165 std::vector<std::unique_ptr<autofill::CreditCard>> credit_card_cache_; | 172 std::vector<std::unique_ptr<autofill::CreditCard>> credit_card_cache_; |
| 166 | 173 |
| 167 std::vector<autofill::CreditCard*> credit_cards_; | 174 std::vector<autofill::CreditCard*> credit_cards_; |
| 168 autofill::CreditCard* selected_credit_card_; | 175 autofill::CreditCard* selected_credit_card_; |
| 169 | 176 |
| 177 // A vector of supported basic card networks. |
| 178 std::vector<std::string> supported_card_networks_; |
| 179 |
| 170 // A vector of pointers to the shipping options in |web_payment_request_|. | 180 // A vector of pointers to the shipping options in |web_payment_request_|. |
| 171 std::vector<web::PaymentShippingOption*> shipping_options_; | 181 std::vector<web::PaymentShippingOption*> shipping_options_; |
| 172 web::PaymentShippingOption* selected_shipping_option_; | 182 web::PaymentShippingOption* selected_shipping_option_; |
| 173 | 183 |
| 174 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 184 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
| 175 }; | 185 }; |
| 176 | 186 |
| 177 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 187 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
| OLD | NEW |