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