Chromium Code Reviews| Index: components/autofill/renderer/autofill_agent.cc |
| diff --git a/components/autofill/renderer/autofill_agent.cc b/components/autofill/renderer/autofill_agent.cc |
| index 2c717832c1929d9ff7387596d5d395a9e27154b8..f169bfba4786fa446ad32708a5d71db37dff6c11 100644 |
| --- a/components/autofill/renderer/autofill_agent.cc |
| +++ b/components/autofill/renderer/autofill_agent.cc |
| @@ -216,7 +216,8 @@ void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { |
| if (!forms.empty() || !frame->parent()) { |
| Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
| forms_seen_timestamp_, |
| - has_more_forms)); |
| + has_more_forms, |
|
ahutter
2013/03/29 19:48:31
Might be good to collapse these bools into an enum
Dane Wallinga
2013/03/29 21:41:12
Bitwise stuff? You mean like in the enum define PA
ahutter
2013/03/29 21:53:08
Yes.
|
| + false /* is_post_document_load */)); |
| } |
| } |
| @@ -731,7 +732,7 @@ 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_, false, false)); |
|
ahutter
2013/03/29 19:48:31
same comment?
|
| } |
| void AutofillAgent::OnRequestAutocompleteResult( |
| @@ -775,6 +776,20 @@ 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_); |
| + if (!forms.empty()) { |
| + Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
| + base::TimeTicks::Now(), |
| + has_more_forms, |
| + true /* is_post_document_load */)); |
| + } |
| + } |
| } |
| void AutofillAgent::ClickFailed() { |
| @@ -932,4 +947,28 @@ 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) { |
|
ahutter
2013/03/29 19:48:31
Can't use an iterator?
Dane Wallinga
2013/03/29 21:41:12
Well at least in WebKit, it's preferred that index
|
| + WebKit::WebNode node = nodes[i]; |
| + if (node.document().frame() == topmost_frame_) { |
| + forms_have_changed_since_load_ = true; |
|
ahutter
2013/03/29 19:48:31
I think you only want to do this once if any of ht
Dane Wallinga
2013/03/29 21:41:12
I have a return further down.
ahutter
2013/03/29 21:53:08
I get that this works but it's more fragile to fut
Dane Wallinga
2013/04/02 19:50:53
Done.
|
| + if (is_whitelisted_for_autocheckout_) { |
| + 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_); |
| + if (!forms.empty()) { |
| + Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, |
| + base::TimeTicks::Now(), |
| + has_more_forms, |
| + true /* is_post_document_load */)); |
| + } |
| + } |
| + return; |
|
ahutter
2013/03/29 19:48:31
Oh. There's a return. That's why this does the r
Dane Wallinga
2013/03/29 21:41:12
Yeah, this one.
|
| + } |
| + } |
| +} |
| + |
| } // namespace autofill |