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|. Uses |address_language_code| to determine line separators when | 140 // |get_info|. |
141 // collapsing street address lines into a single-line input text field. | |
142 bool FillFields( | 141 bool FillFields( |
143 const std::vector<ServerFieldType>& types, | 142 const std::vector<ServerFieldType>& types, |
144 const InputFieldComparator& matches, | 143 const InputFieldComparator& matches, |
145 const base::Callback<base::string16(const AutofillType&)>& get_info, | 144 const base::Callback<base::string16(const AutofillType&)>& get_info, |
146 const std::string& address_language_code, | |
147 const std::string& app_locale); | 145 const std::string& app_locale); |
148 | 146 |
149 // Returns the values that can be filled into the form structure for the | 147 // Returns the values that can be filled into the form structure for the |
150 // given type. For example, there's no way to fill in a value of "The Moon" | 148 // given type. For example, there's no way to fill in a value of "The Moon" |
151 // into ADDRESS_HOME_STATE if the form only has a | 149 // into ADDRESS_HOME_STATE if the form only has a |
152 // <select autocomplete="region"> with no "The Moon" option. Returns an | 150 // <select autocomplete="region"> with no "The Moon" option. Returns an |
153 // empty set if the form doesn't reference the given type or if all inputs | 151 // empty set if the form doesn't reference the given type or if all inputs |
154 // are accepted (e.g., <input type="text" autocomplete="region">). | 152 // are accepted (e.g., <input type="text" autocomplete="region">). |
155 // All returned values are standardized to upper case. | 153 // All returned values are standardized to upper case. |
156 std::set<base::string16> PossibleValues(ServerFieldType type); | 154 std::set<base::string16> PossibleValues(ServerFieldType type); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // Whether the form includes any field types explicitly specified by the site | 249 // Whether the form includes any field types explicitly specified by the site |
252 // author, via the |autocompletetype| attribute. | 250 // author, via the |autocompletetype| attribute. |
253 bool has_author_specified_types_; | 251 bool has_author_specified_types_; |
254 | 252 |
255 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 253 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
256 }; | 254 }; |
257 | 255 |
258 } // namespace autofill | 256 } // namespace autofill |
259 | 257 |
260 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 258 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
OLD | NEW |