OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.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_fi
eld.h" |
11 | 13 |
12 namespace i18n { | 14 namespace i18n { |
13 namespace addressinput { | 15 namespace addressinput { |
14 struct AddressData; | 16 struct AddressData; |
15 } | 17 } |
16 } | 18 } |
17 | 19 |
18 namespace autofill { | 20 namespace autofill { |
19 | 21 |
20 class AutofillProfile; | 22 class AutofillProfile; |
21 class AutofillType; | 23 class AutofillType; |
22 | 24 |
23 namespace i18n { | 25 namespace i18n { |
24 | 26 |
25 // Creates an AddressData object for internationalized address display or | 27 // Creates an AddressData object for internationalized address display or |
26 // validation using |get_info| for field values. | 28 // validation using |get_info| for field values. |
27 scoped_ptr< ::i18n::addressinput::AddressData> CreateAddressData( | 29 scoped_ptr< ::i18n::addressinput::AddressData> CreateAddressData( |
28 const base::Callback<base::string16(const AutofillType&)>& get_info); | 30 const base::Callback<base::string16(const AutofillType&)>& get_info); |
29 | 31 |
30 // Creates an |AddressData| from |profile|. | 32 // Creates an |AddressData| from |profile|. |
31 scoped_ptr< ::i18n::addressinput::AddressData> | 33 scoped_ptr< ::i18n::addressinput::AddressData> |
32 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile, | 34 CreateAddressDataFromAutofillProfile(const AutofillProfile& profile, |
33 const std::string& app_locale); | 35 const std::string& app_locale); |
34 | 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 |
35 } // namespace i18n | 47 } // namespace i18n |
36 } // namespace autofill | 48 } // namespace autofill |
37 | 49 |
38 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ | 50 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ADDRESS_I18N_H_ |
OLD | NEW |