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

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: And a bit of cleanup 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 ceecddb17fa24df776146692322544e1e01bedff..51fd1e4a571b3d45c2d314e8932c0ce27d20589a 100644
--- a/components/autofill/browser/autofill_manager.cc
+++ b/components/autofill/browser/autofill_manager.cc
@@ -455,19 +455,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()) {
- host->Send(
- new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID()));
// 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_WhitelistedForAutocheckout(host->GetRoutingID()));
}
+ // Now return early, as OnFormsSeen will get called again with all forms.
+ if (has_more_forms)
+ return;
}
autocheckout_manager_.OnFormsSeen();

Powered by Google App Engine
This is Rietveld 408576698