Chromium Code Reviews| Index: chrome/browser/autofill/autofill_manager.cc |
| diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc |
| index e11a6d46083d69db54c609ad3fb19f21097e81a4..1bbabfd156fa89f944f6f465795dc563384cf237 100644 |
| --- a/chrome/browser/autofill/autofill_manager.cc |
| +++ b/chrome/browser/autofill/autofill_manager.cc |
| @@ -561,7 +561,10 @@ void AutofillManager::OnFillAutofillFormData(int query_id, |
| // proceed to the next |result| field, and the next |form_structure|. |
| ++i; |
| } |
| - autofilled_forms_signatures_.push_front(form_structure->FormSignature()); |
| + |
| + autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
| + if (autofilled_form_signatures_.size() > 3) |
|
dhollowa
2011/05/06 03:06:20
It is not clear why this is here. Could you expla
Ilya Sherman
2011/05/06 03:33:07
Made '3' a named constant, and added a brief comme
|
| + autofilled_form_signatures_.pop_back(); |
| host->Send(new AutofillMsg_FormDataFilled( |
| host->routing_id(), query_id, result)); |
| @@ -642,25 +645,24 @@ void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
| } |
| void AutofillManager::UploadFormData(const FormStructure& submitted_form) { |
| - if (!disable_download_manager_requests_) { |
| - bool was_autofilled = false; |
| - // Check if the form among last 3 forms that were auto-filled. |
| - // Clear older signatures. |
| - std::list<std::string>::iterator it; |
| - int total_form_checked = 0; |
| - for (it = autofilled_forms_signatures_.begin(); |
| - it != autofilled_forms_signatures_.end() && total_form_checked < 3; |
| - ++it, ++total_form_checked) { |
| - if (*it == submitted_form.FormSignature()) |
| - was_autofilled = true; |
| - } |
| - // Remove outdated form signatures. |
| - if (total_form_checked == 3 && it != autofilled_forms_signatures_.end()) { |
| - autofilled_forms_signatures_.erase(it, |
| - autofilled_forms_signatures_.end()); |
| - } |
| - download_manager_.StartUploadRequest(submitted_form, was_autofilled); |
| + if (disable_download_manager_requests_) |
| + return; |
| + |
| + // Check if the form is among the forms that were recently auto-filled. |
| + bool was_autofilled = false; |
| + for (std::list<std::string>::const_iterator it = |
| + autofilled_form_signatures_.begin(); |
| + it != autofilled_form_signatures_.end() && !was_autofilled; |
| + ++it) { |
| + if (*it == submitted_form.FormSignature()) |
| + was_autofilled = true; |
| } |
| + |
| + FieldTypeSet available_types; |
| + personal_data_->GetAvailableFieldTypes(&available_types); |
| + |
| + download_manager_.StartUploadRequest(submitted_form, was_autofilled, |
| + available_types); |
| } |
| void AutofillManager::Reset() { |