Chromium Code Reviews| Index: components/autofill/core/browser/form_structure.cc |
| diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc |
| index 7e34a6f07491a3c83ad38b73e326dc7dd0bb4ccc..a1af68a8c2c314d249a14115e92163f907294e3a 100644 |
| --- a/components/autofill/core/browser/form_structure.cc |
| +++ b/components/autofill/core/browser/form_structure.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/basictypes.h" |
| #include "base/command_line.h" |
| +#include "base/i18n/case_conversion.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/sha1.h" |
| @@ -1112,6 +1113,33 @@ bool FormStructure::FillFields( |
| return filled_something; |
| } |
| +std::set<base::string16> FormStructure::PossibleValues(ServerFieldType type) { |
| + std::set<base::string16> values; |
| + AutofillType target_type(type); |
| + for (std::vector<AutofillField*>::iterator iter = fields_.begin(); |
| + iter != fields_.end(); ++iter) { |
| + AutofillField* field = *iter; |
| + if (field->Type().GetStorableType() != target_type.GetStorableType() || |
| + field->Type().group() != target_type.group()) { |
| + continue; |
| + } |
| + |
| + // No option values; anything goes. |
| + if (field->option_values.empty()) |
| + return std::set<base::string16>(); |
| + |
| + for (size_t i = 0; i < field->option_values.size(); ++i) { |
| + values.insert(base::i18n::ToUpper(field->option_values[i])); |
| + } |
| + |
| + for (size_t i = 0; i < field->option_contents.size(); ++i) { |
| + values.insert(base::i18n::ToUpper(field->option_contents[i])); |
| + } |
| + } |
| + |
| + return values; |
| +} |
|
Ilya Sherman
2014/03/05 06:09:37
Since you prefer not to add tests to form_structur
Evan Stade
2014/03/05 22:38:31
Don't think I can do that because iOS and Android
|
| + |
| void FormStructure::IdentifySections(bool has_author_specified_sections) { |
| if (fields_.empty()) |
| return; |