Index: components/autofill/renderer/autofill_agent.cc |
diff --git a/components/autofill/renderer/autofill_agent.cc b/components/autofill/renderer/autofill_agent.cc |
index c85c265efae424a9a745c801536f06334b09580f..95e62e0b58610abebc36f9eeab05dc5ca33e7ad6 100644 |
--- a/components/autofill/renderer/autofill_agent.cc |
+++ b/components/autofill/renderer/autofill_agent.cc |
@@ -18,6 +18,7 @@ |
#include "components/autofill/common/form_data.h" |
#include "components/autofill/common/form_data_predictions.h" |
#include "components/autofill/common/form_field_data.h" |
+#include "components/autofill/common/forms_seen_param.h" |
#include "components/autofill/common/web_element_descriptor.h" |
#include "components/autofill/renderer/form_autofill_util.h" |
#include "components/autofill/renderer/password_autofill_manager.h" |
@@ -212,11 +213,14 @@ void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { |
form_cache_.ExtractForms(*frame, &forms); |
} |
+ FormsSeenParam param = has_more_forms ? |
+ autofill::NO_SPECIAL_FORMS_SEEN : autofill::PARTIAL_FORMS_SEEN; |
ahutter
2013/04/02 20:11:47
Is this logic right?
Dane Wallinga
2013/04/02 21:29:30
nope
|
+ |
// Always communicate to browser process for topmost frame. |
if (!forms.empty() || !frame->parent()) { |
Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
forms_seen_timestamp_, |
- has_more_forms)); |
+ param)); |
} |
} |
@@ -726,7 +730,8 @@ void AutofillAgent::OnGetAllForms() { |
// Report to AutofillManager that all forms are being sent. |
Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
- forms_seen_timestamp_, false)); |
+ forms_seen_timestamp_, |
+ NO_SPECIAL_FORMS_SEEN)); |
} |
void AutofillAgent::OnRequestAutocompleteResult( |
@@ -774,6 +779,21 @@ void AutofillAgent::OnFillFormsAndClick( |
void AutofillAgent::OnWhitelistedForAutocheckout() { |
is_whitelisted_for_autocheckout_ = true; |
+ if (forms_have_changed_since_load_) { |
+ forms_have_changed_since_load_ = false; |
+ bool has_more_forms = false; |
+ std::vector<FormData> forms; |
+ form_elements_.clear(); |
+ has_more_forms = form_cache_.ExtractFormsAndFormElements( |
+ *topmost_frame_, kRequiredAutofillFields, &forms, &form_elements_); |
+ FormsSeenParam param = has_more_forms ? |
+ autofill::DYNAMIC_FORMS_SEEN : autofill::PARTIAL_AND_DYNAMIC_FORMS_SEEN; |
ahutter
2013/04/02 20:11:47
Is this backwards?
Dane Wallinga
2013/04/02 21:29:30
most certainly
|
+ if (!forms.empty()) { |
+ Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
+ base::TimeTicks::Now(), |
Raman Kakilate
2013/04/02 20:30:19
timestamp should be the one at which this form is
Dane Wallinga
2013/04/02 21:29:30
Done.
|
+ param)); |
+ } |
+ } |
} |
void AutofillAgent::ClickFailed() { |
@@ -931,4 +951,30 @@ void AutofillAgent::HideHostAutofillUi() { |
Send(new AutofillHostMsg_HideAutofillUi(routing_id())); |
} |
+void AutofillAgent::didAssociateFormControls( |
+ const WebKit::WebVector<WebKit::WebNode>& nodes) { |
+ for (size_t i = 0; i < nodes.size(); ++i) { |
+ WebKit::WebNode node = nodes[i]; |
+ if (node.document().frame() == topmost_frame_) { |
+ forms_have_changed_since_load_ = true; |
+ break; |
+ } |
+ } |
ahutter
2013/04/02 20:11:47
new line.
Dane Wallinga
2013/04/02 21:29:30
Done.
|
+ if (forms_have_changed_since_load_ && is_whitelisted_for_autocheckout_) { |
+ forms_have_changed_since_load_ = false; |
ahutter
2013/04/02 20:11:47
Extract into a function maybe?
|
+ bool has_more_forms = false; |
+ std::vector<FormData> forms; |
+ form_elements_.clear(); |
+ has_more_forms = form_cache_.ExtractFormsAndFormElements( |
+ *topmost_frame_, kRequiredAutofillFields, &forms, &form_elements_); |
+ FormsSeenParam param = has_more_forms ? |
+ autofill::DYNAMIC_FORMS_SEEN : autofill::PARTIAL_AND_DYNAMIC_FORMS_SEEN; |
+ if (!forms.empty()) { |
+ Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
+ base::TimeTicks::Now(), |
Raman Kakilate
2013/04/02 20:30:19
record the timestamp at the start of the function.
Dane Wallinga
2013/04/02 21:29:30
Done.
|
+ param)); |
+ } |
+ } |
+} |
+ |
} // namespace autofill |