Chromium Code Reviews| 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 8f80e4fcba27b56f4cf47938dca1b5139cdacf5f..da8fcaa8101e67e59369eb5f1ce6c755f0f6f81e 100644 |
| --- a/components/autofill/content/renderer/autofill_agent.cc |
| +++ b/components/autofill/content/renderer/autofill_agent.cc |
| @@ -184,6 +184,7 @@ void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { |
| std::vector<FormData> forms; |
| bool has_more_forms = false; |
| if (!frame->parent()) { |
| + topmost_frame_ = frame; |
| form_elements_.clear(); |
| has_more_forms = form_cache_.ExtractFormsAndFormElements( |
| *frame, kRequiredAutofillFields, &forms, &form_elements_); |
| @@ -209,6 +210,9 @@ void AutofillAgent::DidCommitProvisionalLoad(WebFrame* frame, |
| void AutofillAgent::FrameDetached(WebFrame* frame) { |
| form_cache_.ResetFrame(*frame); |
| + if (!frame->parent()) |
| + // |frame| is about to be destroyed so we need to clear |top_most_frame_|. |
| + topmost_frame_ = NULL; |
| } |
| void AutofillAgent::WillSubmitForm(WebFrame* frame, |
| @@ -610,6 +614,13 @@ void AutofillAgent::HideAutofillUI() { |
| // TODO(isherman): Decide if we want to support autofill with AJAX. |
| 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_) { |
|
Ilya Sherman
2013/09/10 01:27:58
Do we really need to cache |topmost_frame_|, or ca
Garrett Casto
2013/09/10 17:13:45
Could you put a comment here as to why we are only
guohui
2013/09/13 15:09:39
Done.
|
| + password_autofill_agent_->OnDynamicFormsSeen(topmost_frame_); |
| + return; |
| + } |
| + } |
| } |
| } // namespace autofill |