Chromium Code Reviews| 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; |
|
Evan Stade
2015/01/22 23:43:44
I think it's cleaner if fakeness is an attribute o
Lei Zhang
2015/01/22 23:58:13
FormData gets serialized as part of a PasswordForm
Evan Stade
2015/01/23 02:21:46
yea but this is not sustainable either. Next time
|
| 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; |