OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/payments/payment_request_utils.h" |
| 6 |
| 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "components/autofill/core/browser/autofill_profile.h" |
| 9 #include "ios/chrome/browser/application_context.h" |
| 10 |
| 11 namespace payment_request_utils { |
| 12 |
| 13 NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) { |
| 14 // Name, company, and country are not included in the shipping address label. |
| 15 std::vector<autofill::ServerFieldType> label_fields; |
| 16 label_fields.push_back(autofill::ADDRESS_HOME_LINE1); |
| 17 label_fields.push_back(autofill::ADDRESS_HOME_LINE2); |
| 18 label_fields.push_back(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY); |
| 19 label_fields.push_back(autofill::ADDRESS_HOME_CITY); |
| 20 label_fields.push_back(autofill::ADDRESS_HOME_STATE); |
| 21 label_fields.push_back(autofill::ADDRESS_HOME_ZIP); |
| 22 label_fields.push_back(autofill::ADDRESS_HOME_SORTING_CODE); |
| 23 |
| 24 return base::SysUTF16ToNSString(profile->ConstructInferredLabel( |
| 25 label_fields, label_fields.size(), |
| 26 GetApplicationContext()->GetApplicationLocale())); |
| 27 } |
| 28 |
| 29 } // namespace payment_request_utils |
OLD | NEW |