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 #import "ios/chrome/browser/payments/payment_request_util.h" | 5 #import "ios/chrome/browser/payments/payment_request_util.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/autofill/core/browser/autofill_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
10 #include "components/autofill/core/browser/field_types.h" | 10 #include "components/autofill/core/browser/field_types.h" |
11 #include "components/strings/grit/components_strings.h" | 11 #include "components/strings/grit/components_strings.h" |
12 #include "ios/chrome/browser/application_context.h" | 12 #include "ios/chrome/browser/application_context.h" |
13 #include "ios/chrome/browser/payments/payment_request.h" | 13 #include "ios/chrome/browser/payments/payment_request.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
16 namespace payment_request_util { | 20 namespace payment_request_util { |
17 | 21 |
18 NSString* NameLabelFromAutofillProfile(autofill::AutofillProfile* profile) { | 22 NSString* NameLabelFromAutofillProfile(autofill::AutofillProfile* profile) { |
19 return base::SysUTF16ToNSString( | 23 return base::SysUTF16ToNSString( |
20 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), | 24 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), |
21 GetApplicationContext()->GetApplicationLocale())); | 25 GetApplicationContext()->GetApplicationLocale())); |
22 } | 26 } |
23 | 27 |
24 NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) { | 28 NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) { |
25 // Name, company, and country are not included in the shipping address label. | 29 // Name, company, and country are not included in the shipping address label. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return l10n_util::GetNSString(IDS_PAYMENTS_UNSUPPORTED_DELIVERY_OPTION); | 165 return l10n_util::GetNSString(IDS_PAYMENTS_UNSUPPORTED_DELIVERY_OPTION); |
162 case web::PaymentShippingType::PICKUP: | 166 case web::PaymentShippingType::PICKUP: |
163 return l10n_util::GetNSString(IDS_PAYMENTS_UNSUPPORTED_PICKUP_OPTION); | 167 return l10n_util::GetNSString(IDS_PAYMENTS_UNSUPPORTED_PICKUP_OPTION); |
164 default: | 168 default: |
165 NOTREACHED(); | 169 NOTREACHED(); |
166 return @""; | 170 return @""; |
167 } | 171 } |
168 } | 172 } |
169 | 173 |
170 } // namespace payment_request_util | 174 } // namespace payment_request_util |
OLD | NEW |