1 // Copyright 2014 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ 7 8 #include "base/callback_forward.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "base/strings/string16.h" 11 #include "components/autofill/core/browser/field_types.h" 12 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_field.h" 13 14 namespace i18n { 15 namespace addressinput { 16 struct AddressData; 17 } 18 } 19 20 namespace autofill { 21 22 class AutofillProfile; 23 class AutofillType; 24 25 namespace i18n { 26 27 // Creates an AddressData object for internationalized address display or 28 // validation using |get_info| for field values. 29 scoped_ptr< ::i18n::addressinput::AddressData> CreateAddressData( 30 const base::Callback<base::string16(const AutofillType&)>& get_info); 31 32 // Creates an |AddressData| from |profile|. 33 scoped_ptr< ::i18n::addressinput::AddressData> 34 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile, 35 const std::string& app_locale); 36 37 // Returns the corresponding Autofill server type for |field|. 38 ServerFieldType TypeForField(::i18n::addressinput::AddressField field, 39 bool billing); 40 41 // Sets |field| to the corresponding address field for the Autofill 42 // |server_type|. Returns |true| if |server_type| can be represented as an 43 // address field. The |field| parameter can be NULL. 44 bool FieldForType(ServerFieldType server_type, 45 ::i18n::addressinput::AddressField* field); 46 47 } // namespace i18n 48 } // namespace autofill 49 50 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ 51