Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: components/autofill/core/browser/form_structure.cc

Issue 178263004: rAc - Only show countries we're able to fill in. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..df980146f51b71f870c48bf2e7f9ee3434a9f730 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,35 @@ 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) {
+ if (!field->option_values[i].empty())
+ values.insert(base::i18n::ToUpper(field->option_values[i]));
+ }
+
+ for (size_t i = 0; i < field->option_contents.size(); ++i) {
+ if (!field->option_contents[i].empty())
+ values.insert(base::i18n::ToUpper(field->option_contents[i]));
+ }
+ }
+
+ return values;
+}
+
void FormStructure::IdentifySections(bool has_author_specified_sections) {
if (fields_.empty())
return;
« no previous file with comments | « components/autofill/core/browser/form_structure.h ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698