| Index: components/autofill/renderer/autofill_agent.cc
|
| diff --git a/components/autofill/renderer/autofill_agent.cc b/components/autofill/renderer/autofill_agent.cc
|
| index f32896b2e8693463d7216224ca6acb9a779ae97e..c083c57810d88d16cf6972690b893c77828ecbc9 100644
|
| --- a/components/autofill/renderer/autofill_agent.cc
|
| +++ b/components/autofill/renderer/autofill_agent.cc
|
| @@ -152,6 +152,7 @@ AutofillAgent::AutofillAgent(content::RenderView* render_view,
|
| did_set_node_text_(false),
|
| autocheckout_click_in_progress_(false),
|
| is_whitelisted_for_autocheckout_(false),
|
| + has_new_forms_for_manager_(false),
|
| ignore_text_changes_(false),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
|
| render_view->GetWebView()->setAutofillClient(this);
|
| @@ -211,11 +212,14 @@ void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) {
|
| form_cache_.ExtractForms(*frame, &forms);
|
| }
|
|
|
| + autofill::FormsSeenParam param = has_more_forms ?
|
| + autofill::PARTIAL_FORMS_SEEN : autofill::NO_SPECIAL_FORMS_SEEN;
|
| +
|
| // 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));
|
| }
|
| }
|
|
|
| @@ -725,7 +729,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(
|
| @@ -773,6 +778,8 @@ void AutofillAgent::OnFillFormsAndClick(
|
|
|
| void AutofillAgent::OnWhitelistedForAutocheckout() {
|
| is_whitelisted_for_autocheckout_ = true;
|
| + if (has_new_forms_for_manager_)
|
| + MaybeSendDynamicFormsSeen();
|
| }
|
|
|
| void AutofillAgent::ClickFailed() {
|
| @@ -932,4 +939,36 @@ 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_seen_timestamp_ = base::TimeTicks::Now();
|
| + has_new_forms_for_manager_ = true;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + if (has_new_forms_for_manager_ && is_whitelisted_for_autocheckout_)
|
| + MaybeSendDynamicFormsSeen();
|
| +}
|
| +
|
| +void AutofillAgent::MaybeSendDynamicFormsSeen() {
|
| + has_new_forms_for_manager_ = false;
|
| + form_elements_.clear();
|
| +
|
| + std::vector<FormData> forms;
|
| + bool has_more_forms = form_cache_.ExtractFormsAndFormElements(
|
| + *topmost_frame_, kRequiredAutofillFields, &forms, &form_elements_);
|
| + autofill::FormsSeenParam param = has_more_forms ?
|
| + autofill::PARTIAL_AND_DYNAMIC_FORMS_SEEN : autofill::DYNAMIC_FORMS_SEEN;
|
| +
|
| + if (!forms.empty()) {
|
| + Send(new AutofillHostMsg_FormsSeen(routing_id(), forms,
|
| + forms_seen_timestamp_,
|
| + param));
|
| + }
|
| +}
|
| +
|
| } // namespace autofill
|
|
|