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

Unified Diff: components/autofill/content/renderer/form_cache.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: Address comments 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/content/renderer/form_cache.cc
diff --git a/components/autofill/content/renderer/form_cache.cc b/components/autofill/content/renderer/form_cache.cc
index 9bc97e2f5505c598566d3a66b4995d9839aa2dd4..0b9bc8abbfeae00bc27039882cd8c1e2550d1dc6 100644
--- a/components/autofill/content/renderer/form_cache.cc
+++ b/components/autofill/content/renderer/form_cache.cc
@@ -75,7 +75,10 @@ FormCache::FormCache(const WebFrame& frame) : frame_(frame) {
FormCache::~FormCache() {
}
-std::vector<FormData> FormCache::ExtractNewForms() {
+std::vector<FormData> FormCache::ExtractNewForms(size_t* unowned_form_index) {
+ DCHECK(unowned_form_index);
+
+ *unowned_form_index = 0;
std::vector<FormData> forms;
WebDocument document = frame_.document();
if (document.isNull())
@@ -115,6 +118,7 @@ std::vector<FormData> FormCache::ExtractNewForms() {
if (form.fields.size() >= kRequiredAutofillFields &&
!ContainsKey(parsed_forms_, form)) {
+ ++(*unowned_form_index);
forms.push_back(form);
parsed_forms_.insert(form);
}
@@ -145,6 +149,7 @@ std::vector<FormData> FormCache::ExtractNewForms() {
if (synthetic_form.fields.size() >= kRequiredAutofillFields &&
!parsed_forms_.count(synthetic_form)) {
+ // |*unowned_form_index| is already at the right index here.
forms.push_back(synthetic_form);
parsed_forms_.insert(synthetic_form);
synthetic_form_ = synthetic_form;

Powered by Google App Engine
This is Rietveld 408576698