OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FORM_STRUCTURE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // at least one field. | 130 // at least one field. |
131 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, | 131 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, |
132 bool* found_sections); | 132 bool* found_sections); |
133 | 133 |
134 // Determines whether |type| and |field| match. | 134 // Determines whether |type| and |field| match. |
135 typedef base::Callback<bool(ServerFieldType type, | 135 typedef base::Callback<bool(ServerFieldType type, |
136 const AutofillField& field)> | 136 const AutofillField& field)> |
137 InputFieldComparator; | 137 InputFieldComparator; |
138 | 138 |
139 // Fills in |fields_| that match |types| (via |matches|) with info from | 139 // Fills in |fields_| that match |types| (via |matches|) with info from |
140 // |get_info|. | 140 // |get_info|. Uses |address_language_code| to determine line separators when |
| 141 // collapsing street address lines into a single-line input text field. |
141 bool FillFields( | 142 bool FillFields( |
142 const std::vector<ServerFieldType>& types, | 143 const std::vector<ServerFieldType>& types, |
143 const InputFieldComparator& matches, | 144 const InputFieldComparator& matches, |
144 const base::Callback<base::string16(const AutofillType&)>& get_info, | 145 const base::Callback<base::string16(const AutofillType&)>& get_info, |
| 146 const std::string& address_language_code, |
145 const std::string& app_locale); | 147 const std::string& app_locale); |
146 | 148 |
147 // Returns the values that can be filled into the form structure for the | 149 // Returns the values that can be filled into the form structure for the |
148 // given type. For example, there's no way to fill in a value of "The Moon" | 150 // given type. For example, there's no way to fill in a value of "The Moon" |
149 // into ADDRESS_HOME_STATE if the form only has a | 151 // into ADDRESS_HOME_STATE if the form only has a |
150 // <select autocomplete="region"> with no "The Moon" option. Returns an | 152 // <select autocomplete="region"> with no "The Moon" option. Returns an |
151 // empty set if the form doesn't reference the given type or if all inputs | 153 // empty set if the form doesn't reference the given type or if all inputs |
152 // are accepted (e.g., <input type="text" autocomplete="region">). | 154 // are accepted (e.g., <input type="text" autocomplete="region">). |
153 // All returned values are standardized to upper case. | 155 // All returned values are standardized to upper case. |
154 std::set<base::string16> PossibleValues(ServerFieldType type); | 156 std::set<base::string16> PossibleValues(ServerFieldType type); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // Whether the form includes any field types explicitly specified by the site | 251 // Whether the form includes any field types explicitly specified by the site |
250 // author, via the |autocompletetype| attribute. | 252 // author, via the |autocompletetype| attribute. |
251 bool has_author_specified_types_; | 253 bool has_author_specified_types_; |
252 | 254 |
253 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 255 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
254 }; | 256 }; |
255 | 257 |
256 } // namespace autofill | 258 } // namespace autofill |
257 | 259 |
258 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 260 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |