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 #include "components/payments/payment_request.h" | 5 #include "components/payments/payment_request.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/payments/payment_details_validation.h" | 8 #include "components/payments/payment_details_validation.h" |
9 #include "components/payments/payment_request_web_contents_manager.h" | 9 #include "components/payments/payment_request_web_contents_manager.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const std::vector<autofill::AutofillProfile*>& | 122 const std::vector<autofill::AutofillProfile*>& |
123 PaymentRequest::shipping_profiles() { | 123 PaymentRequest::shipping_profiles() { |
124 return shipping_profiles_; | 124 return shipping_profiles_; |
125 } | 125 } |
126 | 126 |
127 const std::vector<autofill::AutofillProfile*>& | 127 const std::vector<autofill::AutofillProfile*>& |
128 PaymentRequest::contact_profiles() { | 128 PaymentRequest::contact_profiles() { |
129 return contact_profiles_; | 129 return contact_profiles_; |
130 } | 130 } |
131 | 131 |
132 const std::vector<autofill::CreditCard*>& PaymentRequest::credit_cards() { | |
133 return credit_cards_; | |
134 } | |
135 | |
136 void PaymentRequest::PopulateProfileCache() { | 132 void PaymentRequest::PopulateProfileCache() { |
137 std::vector<autofill::AutofillProfile*> profiles = | 133 std::vector<autofill::AutofillProfile*> profiles = |
138 personal_data_manager()->GetProfilesToSuggest(); | 134 personal_data_manager()->GetProfilesToSuggest(); |
139 | 135 |
140 // PaymentRequest may outlive the Profiles returned by the Data Manager. | 136 // PaymentRequest may outlive the Profiles returned by the Data Manager. |
141 // Thus, we store copies, and return a vector of pointers to these copies | 137 // Thus, we store copies, and return a vector of pointers to these copies |
142 // whenever Profiles are requested. The same is true for credit cards. | 138 // whenever Profiles are requested. The same is true for credit cards. |
143 for (size_t i = 0; i < profiles.size(); i++) { | 139 for (size_t i = 0; i < profiles.size(); i++) { |
144 profile_cache_.push_back( | 140 profile_cache_.push_back( |
145 base::MakeUnique<autofill::AutofillProfile>(*profiles[i])); | 141 base::MakeUnique<autofill::AutofillProfile>(*profiles[i])); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 card_networks.erase(card_it); | 237 card_networks.erase(card_it); |
242 } | 238 } |
243 } | 239 } |
244 } | 240 } |
245 } | 241 } |
246 } | 242 } |
247 } | 243 } |
248 } | 244 } |
249 | 245 |
250 } // namespace payments | 246 } // namespace payments |
OLD | NEW |