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 <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 std::set<base::string16> PossibleValues(ServerFieldType type); | |
|
Ilya Sherman
2014/03/03 23:55:54
'ServerFieldType' is a strange choice of type to p
Ilya Sherman
2014/03/03 23:55:54
nit: This method name is rather vague. Perhaps "G
Ilya Sherman
2014/03/03 23:55:54
You are expanding the public API of this class, so
Evan Stade
2014/03/04 00:11:30
I started with that, but it makes the call sites m
Evan Stade
2014/03/04 00:11:30
Do you think it's vague when you see it in the con
Evan Stade
2014/03/04 00:11:30
See my other comment on why I think that is a bad
Ilya Sherman
2014/03/04 00:53:57
Yes, I do. The call site just forwards a bunch of
Ilya Sherman
2014/03/04 00:53:57
This code lives in a different component from the
| |
| 162 | |
| 154 const AutofillField* field(size_t index) const; | 163 const AutofillField* field(size_t index) const; |
| 155 AutofillField* field(size_t index); | 164 AutofillField* field(size_t index); |
| 156 size_t field_count() const; | 165 size_t field_count() const; |
| 157 | 166 |
| 158 // Returns the number of fields that are able to be autofilled. | 167 // Returns the number of fields that are able to be autofilled. |
| 159 size_t autofill_count() const { return autofill_count_; } | 168 size_t autofill_count() const { return autofill_count_; } |
| 160 | 169 |
| 161 // Used for iterating over the fields. | 170 // Used for iterating over the fields. |
| 162 std::vector<AutofillField*>::const_iterator begin() const { | 171 std::vector<AutofillField*>::const_iterator begin() const { |
| 163 return fields_.begin(); | 172 return fields_.begin(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 // Whether the form includes any field types explicitly specified by the site | 261 // Whether the form includes any field types explicitly specified by the site |
| 253 // author, via the |autocompletetype| attribute. | 262 // author, via the |autocompletetype| attribute. |
| 254 bool has_author_specified_types_; | 263 bool has_author_specified_types_; |
| 255 | 264 |
| 256 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 265 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 257 }; | 266 }; |
| 258 | 267 |
| 259 } // namespace autofill | 268 } // namespace autofill |
| 260 | 269 |
| 261 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ | 270 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ |
| OLD | NEW |