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

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

Issue 853523004: Autofill: Set requirements for number of recognized fields in an autofillable form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More relaxed check for form tag Created 5 years, 11 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/address_field.cc
diff --git a/components/autofill/core/browser/address_field.cc b/components/autofill/core/browser/address_field.cc
index 0791eb3c9daf45029ad4f08f51c8f09ee7df2ba5..4d835c4babee0937f753c10148b59c7d2f7e3016 100644
--- a/components/autofill/core/browser/address_field.cc
+++ b/components/autofill/core/browser/address_field.cc
@@ -126,6 +126,33 @@ bool AddressField::ClassifyField(ServerFieldTypeMap* map) const {
AddClassification(country_, ADDRESS_HOME_COUNTRY, map);
}
+size_t AddressField::FieldCount() const {
+ size_t count = 0;
+
+ if (company_)
+ ++count;
+ if (address1_)
+ ++count;
+ if (address2_)
+ ++count;
+ if (address3_)
+ ++count;
+ if (street_address_)
+ ++count;
+ if (city_)
+ ++count;
+ if (state_)
+ ++count;
+ if (zip_)
+ ++count;
+ if (zip4_)
+ ++count;
+ if (country_)
+ ++count;
+
+ return count;;
Evan Stade 2015/01/21 22:52:49 nit: ;;
Lei Zhang 2015/01/22 08:07:36 Done.
+}
+
bool AddressField::ParseCompany(AutofillScanner* scanner) {
if (company_ && !company_->IsEmpty())
return false;

Powered by Google App Engine
This is Rietveld 408576698