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