OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_AUTOFILL_ADDRESS_UTIL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ADDRESS_UTIL_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ADDRESS_UTIL_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ADDRESS_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "components/autofill/core/browser/field_types.h" |
| 11 |
10 namespace base { | 12 namespace base { |
11 class ListValue; | 13 class ListValue; |
12 class DictionaryValue; | 14 class DictionaryValue; |
13 } | 15 } |
14 | 16 |
15 namespace autofill { | 17 namespace autofill { |
16 | 18 |
17 class PersonalDataManager; | 19 class PersonalDataManager; |
18 | 20 |
19 // Dictionary key for the field type. | 21 // Dictionary key for the field type. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 53 |
52 // Field name for autofill::ADDRESS_HOME_COUNTRY. | 54 // Field name for autofill::ADDRESS_HOME_COUNTRY. |
53 extern const char kCountryField[]; | 55 extern const char kCountryField[]; |
54 | 56 |
55 // AddressUiComponent::HINT_SHORT. | 57 // AddressUiComponent::HINT_SHORT. |
56 extern const char kShortField[]; | 58 extern const char kShortField[]; |
57 | 59 |
58 // AddressUiComponent::HINT_LONG. | 60 // AddressUiComponent::HINT_LONG. |
59 extern const char kLongField[]; | 61 extern const char kLongField[]; |
60 | 62 |
| 63 // Converts a field type in string format as returned by |
| 64 // autofill::GetAddressComponents into the appropriate autofill::ServerFieldType |
| 65 // enum. |
| 66 ServerFieldType GetFieldTypeFromString(const std::string& type); |
| 67 |
61 // Fills |components| with the address UI components that should be used to | 68 // Fills |components| with the address UI components that should be used to |
62 // input an address for |country_code| when UI BCP 47 language code is | 69 // input an address for |country_code| when UI BCP 47 language code is |
63 // |ui_language_code|. If |components_language_code| is not NULL, then sets it | 70 // |ui_language_code|. If |components_language_code| is not NULL, then sets it |
64 // to the BCP 47 language code that should be used to format the address for | 71 // to the BCP 47 language code that should be used to format the address for |
65 // display. | 72 // display. |
66 void GetAddressComponents(const std::string& country_code, | 73 void GetAddressComponents(const std::string& country_code, |
67 const std::string& ui_language_code, | 74 const std::string& ui_language_code, |
68 base::ListValue* address_components, | 75 base::ListValue* address_components, |
69 std::string* components_language_code); | 76 std::string* components_language_code); |
70 | 77 |
71 // Sets data related to the country combobox. | 78 // Sets data related to the country combobox. |
72 void SetCountryData(const PersonalDataManager& manager, | 79 void SetCountryData(const PersonalDataManager& manager, |
73 base::DictionaryValue* localized_strings, | 80 base::DictionaryValue* localized_strings, |
74 const std::string& ui_language_code); | 81 const std::string& ui_language_code); |
75 | 82 |
76 } // namespace autofill | 83 } // namespace autofill |
77 | 84 |
78 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ADDRESS_UTIL_H_ | 85 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_ADDRESS_UTIL_H_ |
OLD | NEW |