| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string16.h" |
| 14 #include "components/autofill/core/browser/autofill_field.h" | 16 #include "components/autofill/core/browser/autofill_field.h" |
| 15 #include "components/autofill/core/browser/autofill_type.h" | 17 #include "components/autofill/core/browser/autofill_type.h" |
| 16 #include "components/autofill/core/browser/field_types.h" | 18 #include "components/autofill/core/browser/field_types.h" |
| 17 #include "components/autofill/core/common/web_element_descriptor.h" | 19 #include "components/autofill/core/common/web_element_descriptor.h" |
| 18 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 19 | 21 |
| 20 enum RequestMethod { | 22 enum RequestMethod { |
| 21 GET, | 23 GET, |
| 22 POST | 24 POST |
| 23 }; | 25 }; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Classifies each field in |fields_| based upon its |autocomplete| attribute, | 131 // Classifies each field in |fields_| based upon its |autocomplete| attribute, |
| 130 // if the attribute is available. The association is stored into the field's | 132 // if the attribute is available. The association is stored into the field's |
| 131 // |heuristic_type|. | 133 // |heuristic_type|. |
| 132 // Fills |found_types| with |true| if the attribute is available and neither | 134 // Fills |found_types| with |true| if the attribute is available and neither |
| 133 // empty nor set to the special values "on" or "off" for at least one field. | 135 // empty nor set to the special values "on" or "off" for at least one field. |
| 134 // Fills |found_sections| with |true| if the attribute specifies a section for | 136 // Fills |found_sections| with |true| if the attribute specifies a section for |
| 135 // at least one field. | 137 // at least one field. |
| 136 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, | 138 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types, |
| 137 bool* found_sections); | 139 bool* found_sections); |
| 138 | 140 |
| 141 // Determines whether |type| and |field| match. |
| 142 typedef base::Callback<bool(ServerFieldType type, |
| 143 const AutofillField& field)> |
| 144 InputFieldComparator; |
| 145 |
| 146 // Fills in |fields_| that match |types| (via |matches|) with info from |
| 147 // |get_info|. |
| 148 bool FillFields( |
| 149 const std::vector<ServerFieldType>& types, |
| 150 const InputFieldComparator& matches, |
| 151 const base::Callback<base::string16(const AutofillType&)>& get_info, |
| 152 const std::string& app_locale); |
| 153 |
| 139 const AutofillField* field(size_t index) const; | 154 const AutofillField* field(size_t index) const; |
| 140 AutofillField* field(size_t index); | 155 AutofillField* field(size_t index); |
| 141 size_t field_count() const; | 156 size_t field_count() const; |
| 142 | 157 |
| 143 // Returns the number of fields that are able to be autofilled. | 158 // Returns the number of fields that are able to be autofilled. |
| 144 size_t autofill_count() const { return autofill_count_; } | 159 size_t autofill_count() const { return autofill_count_; } |
| 145 | 160 |
| 146 // Used for iterating over the fields. | 161 // Used for iterating over the fields. |
| 147 std::vector<AutofillField*>::const_iterator begin() const { | 162 std::vector<AutofillField*>::const_iterator begin() const { |
| 148 return fields_.begin(); | 163 return fields_.begin(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Whether the form includes any field types explicitly specified by the site | 252 // Whether the form includes any field types explicitly specified by the site |
| 238 // author, via the |autocompletetype| attribute. | 253 // author, via the |autocompletetype| attribute. |
| 239 bool has_author_specified_types_; | 254 bool has_author_specified_types_; |
| 240 | 255 |
| 241 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 256 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 242 }; | 257 }; |
| 243 | 258 |
| 244 } // namespace autofill | 259 } // namespace autofill |
| 245 | 260 |
| 246 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 261 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| OLD | NEW |