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 #include "ios/chrome/browser/payments/payment_request.h" | 5 #include "ios/chrome/browser/payments/payment_request.h" |
6 | 6 |
7 #include <unordered_set> | 7 #include <unordered_set> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/autofill/core/browser/autofill_data_util.h" | 10 #include "components/autofill/core/browser/autofill_data_util.h" |
11 #include "components/autofill/core/browser/autofill_profile.h" | 11 #include "components/autofill/core/browser/autofill_profile.h" |
12 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
13 #include "components/autofill/core/browser/personal_data_manager.h" | 13 #include "components/autofill/core/browser/personal_data_manager.h" |
14 #include "components/payments/currency_formatter.h" | 14 #include "components/payments/currency_formatter.h" |
15 #include "ios/chrome/browser/application_context.h" | 15 #include "ios/chrome/browser/application_context.h" |
16 #include "ios/web/public/payments/payment_request.h" | 16 #include "ios/web/public/payments/payment_request.h" |
17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." |
| 20 #endif |
| 21 |
18 PaymentRequest::PaymentRequest( | 22 PaymentRequest::PaymentRequest( |
19 std::unique_ptr<web::PaymentRequest> web_payment_request, | 23 std::unique_ptr<web::PaymentRequest> web_payment_request, |
20 autofill::PersonalDataManager* personal_data_manager) | 24 autofill::PersonalDataManager* personal_data_manager) |
21 : web_payment_request_(std::move(web_payment_request)), | 25 : web_payment_request_(std::move(web_payment_request)), |
22 personal_data_manager_(personal_data_manager), | 26 personal_data_manager_(personal_data_manager), |
23 selected_shipping_profile_(nullptr), | 27 selected_shipping_profile_(nullptr), |
24 selected_credit_card_(nullptr), | 28 selected_credit_card_(nullptr), |
25 selected_shipping_option_(nullptr) { | 29 selected_shipping_option_(nullptr) { |
26 PopulateProfileCache(); | 30 PopulateProfileCache(); |
27 PopulateCreditCardCache(); | 31 PopulateCreditCardCache(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 102 |
99 selected_shipping_option_ = nullptr; | 103 selected_shipping_option_ = nullptr; |
100 for (const auto& shipping_option : shipping_options_) { | 104 for (const auto& shipping_option : shipping_options_) { |
101 if (shipping_option->selected) { | 105 if (shipping_option->selected) { |
102 // If more than one option has |selected| set, the last one in the | 106 // If more than one option has |selected| set, the last one in the |
103 // sequence should be treated as the selected item. | 107 // sequence should be treated as the selected item. |
104 selected_shipping_option_ = shipping_option; | 108 selected_shipping_option_ = shipping_option; |
105 } | 109 } |
106 } | 110 } |
107 } | 111 } |
OLD | NEW |