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 "ios/chrome/browser/application_context.h" | 11 #include "ios/chrome/browser/application_context.h" |
12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
13 namespace payment_request_util { | 17 namespace payment_request_util { |
14 | 18 |
15 NSString* NameLabelFromAutofillProfile(autofill::AutofillProfile* profile) { | 19 NSString* NameLabelFromAutofillProfile(autofill::AutofillProfile* profile) { |
16 return base::SysUTF16ToNSString( | 20 return base::SysUTF16ToNSString( |
17 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), | 21 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), |
18 GetApplicationContext()->GetApplicationLocale())); | 22 GetApplicationContext()->GetApplicationLocale())); |
19 } | 23 } |
20 | 24 |
21 NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) { | 25 NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) { |
22 // Name, company, and country are not included in the shipping address label. | 26 // Name, company, and country are not included in the shipping address label. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 address.organization = profile->GetRawInfo(autofill::COMPANY_NAME); | 66 address.organization = profile->GetRawInfo(autofill::COMPANY_NAME); |
63 address.recipient = | 67 address.recipient = |
64 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), | 68 profile->GetInfo(autofill::AutofillType(autofill::NAME_FULL), |
65 GetApplicationContext()->GetApplicationLocale()); | 69 GetApplicationContext()->GetApplicationLocale()); |
66 address.phone = profile->GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER); | 70 address.phone = profile->GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER); |
67 | 71 |
68 return address; | 72 return address; |
69 } | 73 } |
70 | 74 |
71 } // namespace payment_request_util | 75 } // namespace payment_request_util |
OLD | NEW |