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

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1494373003: [Autofill] Send Autofill upload when active form loses focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed test Created 5 years 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/autofill_agent.cc
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index d2bea330cd760d16e0f3dc9958fd13ddd8bd00cd..47031e518f44e71c913dc315e0839a5aee5fe848 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -259,11 +259,24 @@ void AutofillAgent::DidChangeScrollOffset() {
void AutofillAgent::FocusedNodeChanged(const WebNode& node) {
HidePopup();
- if (node.isNull() || !node.isElementNode())
+ if (node.isNull() || !node.isElementNode()) {
+ if (!last_interacted_form_.isNull()) {
+ // Focus moved away from the last interacted form to somewhere else on
+ // the page.
+ Send(new AutofillHostMsg_FocusNoLongerOnForm(routing_id()));
+ }
return;
+ }
WebElement web_element = node.toConst<WebElement>();
const WebInputElement* element = toWebInputElement(&web_element);
+ if (!element || (!last_interacted_form_.isNull() &&
+ last_interacted_form_ != element->form())) {
+ // The focused element is not part of the last interacted form (could be
+ // in a different form).
+ Send(new AutofillHostMsg_FocusNoLongerOnForm(routing_id()));
+ return;
+ }
if (!element || !element->isEnabled() || element->isReadOnly() ||
!element->isTextField())
@@ -519,7 +532,7 @@ void AutofillAgent::OnFillForm(int query_id, const FormData& form) {
if (!element_.form().isNull())
last_interacted_form_ = element_.form();
- Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(),
+ Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id(), form,
base::TimeTicks::Now()));
}
« no previous file with comments | « components/autofill/content/common/autofill_messages.h ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698