Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / autofill / core / browser / address_i18n.h
blob8ae3c56903c1e9e4bfe89964524627585ca80ff5
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.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_
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"
14 namespace i18n {
15 namespace addressinput {
16 struct AddressData;
20 namespace autofill {
22 class AutofillProfile;
23 class AutofillType;
25 namespace i18n {
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);
32 // Creates an |AddressData| from |profile|.
33 scoped_ptr< ::i18n::addressinput::AddressData>
34 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile,
35 const std::string& app_locale);
37 // Returns the corresponding Autofill server type for |field|.
38 ServerFieldType TypeForField(::i18n::addressinput::AddressField field,
39 bool billing);
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);
47 } // namespace i18n
48 } // namespace autofill
50 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_