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

Unified Diff: components/autofill/browser/autofill_manager.cc

Issue 13264002: Requery the autofill server when forms and input fields are dynamically added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fun with merging Created 7 years, 8 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/browser/autofill_manager.cc
diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc
index 20c16e8bf3d2f0b263dea40ab64d4e322af53c2b..f2e29075dc8f350bd608e41f59109523ef35dc19 100644
--- a/components/autofill/browser/autofill_manager.cc
+++ b/components/autofill/browser/autofill_manager.cc
@@ -381,17 +381,28 @@ bool AutofillManager::OnFormSubmitted(const FormData& form,
void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
const TimeTicks& timestamp,
- bool has_more_forms) {
+ autofill::FormsSeenState state) {
+ bool is_post_document_load = state == autofill::DYNAMIC_FORMS_SEEN;
+ bool has_more_forms = state == autofill::PARTIAL_FORMS_SEEN;
+ // If new forms were added via AJAX or DHML, treat as new page.
+ if (is_post_document_load)
+ Reset();
+
RenderViewHost* host = web_contents()->GetRenderViewHost();
if (!host)
return;
if (!GetAutocheckoutURLPrefix().empty()) {
// If whitelisted URL, fetch all the forms.
- if (has_more_forms) {
+ if (has_more_forms)
host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID()));
- return;
+ if (!is_post_document_load) {
+ host->Send(
+ new AutofillMsg_AutocheckoutSupported(host->GetRoutingID()));
}
+ // Now return early, as OnFormsSeen will get called again with all forms.
+ if (has_more_forms)
+ return;
}
autocheckout_manager_.OnFormsSeen();
« no previous file with comments | « components/autofill/browser/autofill_manager.h ('k') | components/autofill/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698