| 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 <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "components/autofill/core/browser/autofill_field.h" | 17 #include "components/autofill/core/browser/autofill_field.h" |
| 17 #include "components/autofill/core/browser/autofill_type.h" | 18 #include "components/autofill/core/browser/autofill_type.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 InputFieldComparator; | 145 InputFieldComparator; |
| 145 | 146 |
| 146 // Fills in |fields_| that match |types| (via |matches|) with info from | 147 // Fills in |fields_| that match |types| (via |matches|) with info from |
| 147 // |get_info|. | 148 // |get_info|. |
| 148 bool FillFields( | 149 bool FillFields( |
| 149 const std::vector<ServerFieldType>& types, | 150 const std::vector<ServerFieldType>& types, |
| 150 const InputFieldComparator& matches, | 151 const InputFieldComparator& matches, |
| 151 const base::Callback<base::string16(const AutofillType&)>& get_info, | 152 const base::Callback<base::string16(const AutofillType&)>& get_info, |
| 152 const std::string& app_locale); | 153 const std::string& app_locale); |
| 153 | 154 |
| 155 // Returns the values that can be filled into the form structure for the |
| 156 // given type. For example, there's no way to fill in a value of "The Moon" |
| 157 // into ADDRESS_HOME_STATE if the form only has a |
| 158 // <select autocomplete="region"> with no "The Moon" option. Returns an |
| 159 // empty set if the form doesn't reference the given type or if all inputs |
| 160 // are accepted (e.g., <input type="text" autocomplete="region">). |
| 161 // All returned values are standardized to upper case. |
| 162 std::set<base::string16> PossibleValues(ServerFieldType type); |
| 163 |
| 154 const AutofillField* field(size_t index) const; | 164 const AutofillField* field(size_t index) const; |
| 155 AutofillField* field(size_t index); | 165 AutofillField* field(size_t index); |
| 156 size_t field_count() const; | 166 size_t field_count() const; |
| 157 | 167 |
| 158 // Returns the number of fields that are able to be autofilled. | 168 // Returns the number of fields that are able to be autofilled. |
| 159 size_t autofill_count() const { return autofill_count_; } | 169 size_t autofill_count() const { return autofill_count_; } |
| 160 | 170 |
| 161 // Used for iterating over the fields. | 171 // Used for iterating over the fields. |
| 162 std::vector<AutofillField*>::const_iterator begin() const { | 172 std::vector<AutofillField*>::const_iterator begin() const { |
| 163 return fields_.begin(); | 173 return fields_.begin(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Whether the form includes any field types explicitly specified by the site | 256 // Whether the form includes any field types explicitly specified by the site |
| 247 // author, via the |autocompletetype| attribute. | 257 // author, via the |autocompletetype| attribute. |
| 248 bool has_author_specified_types_; | 258 bool has_author_specified_types_; |
| 249 | 259 |
| 250 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 260 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 251 }; | 261 }; |
| 252 | 262 |
| 253 } // namespace autofill | 263 } // namespace autofill |
| 254 | 264 |
| 255 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 265 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| OLD | NEW |