| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/content/renderer/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 AutofillAgent::AutofillAgent(content::RenderFrame* render_frame, | 165 AutofillAgent::AutofillAgent(content::RenderFrame* render_frame, |
| 166 PasswordAutofillAgent* password_autofill_agent, | 166 PasswordAutofillAgent* password_autofill_agent, |
| 167 PasswordGenerationAgent* password_generation_agent) | 167 PasswordGenerationAgent* password_generation_agent) |
| 168 : content::RenderFrameObserver(render_frame), | 168 : content::RenderFrameObserver(render_frame), |
| 169 form_cache_(*render_frame->GetWebFrame()), | 169 form_cache_(*render_frame->GetWebFrame()), |
| 170 password_autofill_agent_(password_autofill_agent), | 170 password_autofill_agent_(password_autofill_agent), |
| 171 password_generation_agent_(password_generation_agent), | 171 password_generation_agent_(password_generation_agent), |
| 172 legacy_(render_frame->GetRenderView(), this), | 172 legacy_(render_frame->GetRenderView(), this), |
| 173 autofill_query_id_(0), | 173 autofill_query_id_(0), |
| 174 was_query_node_autofilled_(false), | 174 was_query_node_autofilled_(false), |
| 175 has_shown_autofill_popup_for_current_edit_(false), | |
| 176 ignore_text_changes_(false), | 175 ignore_text_changes_(false), |
| 177 is_popup_possibly_visible_(false), | 176 is_popup_possibly_visible_(false), |
| 178 is_generation_popup_possibly_visible_(false), | 177 is_generation_popup_possibly_visible_(false), |
| 179 weak_ptr_factory_(this) { | 178 weak_ptr_factory_(this) { |
| 180 render_frame->GetWebFrame()->setAutofillClient(this); | 179 render_frame->GetWebFrame()->setAutofillClient(this); |
| 181 | 180 |
| 182 // AutofillAgent is guaranteed to outlive |render_frame|. | 181 // AutofillAgent is guaranteed to outlive |render_frame|. |
| 183 render_frame->GetServiceRegistry()->AddService( | 182 render_frame->GetServiceRegistry()->AddService( |
| 184 base::Bind(&AutofillAgent::BindRequest, base::Unretained(this))); | 183 base::Bind(&AutofillAgent::BindRequest, base::Unretained(this))); |
| 185 | 184 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // the initial click (not focused yet), only show password suggestions. | 362 // the initial click (not focused yet), only show password suggestions. |
| 364 options.show_full_suggestion_list = | 363 options.show_full_suggestion_list = |
| 365 options.show_full_suggestion_list || was_focused; | 364 options.show_full_suggestion_list || was_focused; |
| 366 options.show_password_suggestions_only = !was_focused; | 365 options.show_password_suggestions_only = !was_focused; |
| 367 } | 366 } |
| 368 ShowSuggestions(element, options); | 367 ShowSuggestions(element, options); |
| 369 } | 368 } |
| 370 | 369 |
| 371 void AutofillAgent::textFieldDidEndEditing(const WebInputElement& element) { | 370 void AutofillAgent::textFieldDidEndEditing(const WebInputElement& element) { |
| 372 password_autofill_agent_->TextFieldDidEndEditing(element); | 371 password_autofill_agent_->TextFieldDidEndEditing(element); |
| 373 has_shown_autofill_popup_for_current_edit_ = false; | |
| 374 Send(new AutofillHostMsg_DidEndTextFieldEditing(routing_id())); | 372 Send(new AutofillHostMsg_DidEndTextFieldEditing(routing_id())); |
| 375 } | 373 } |
| 376 | 374 |
| 377 void AutofillAgent::textFieldDidChange(const WebFormControlElement& element) { | 375 void AutofillAgent::textFieldDidChange(const WebFormControlElement& element) { |
| 378 DCHECK(toWebInputElement(&element) || form_util::IsTextAreaElement(element)); | 376 DCHECK(toWebInputElement(&element) || form_util::IsTextAreaElement(element)); |
| 379 | 377 |
| 380 if (ignore_text_changes_) | 378 if (ignore_text_changes_) |
| 381 return; | 379 return; |
| 382 | 380 |
| 383 // Disregard text changes that aren't caused by user gestures or pastes. Note | 381 // Disregard text changes that aren't caused by user gestures or pastes. Note |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 795 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 798 // No-op. Don't delete |this|. | 796 // No-op. Don't delete |this|. |
| 799 } | 797 } |
| 800 | 798 |
| 801 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 799 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 802 if (agent_) | 800 if (agent_) |
| 803 agent_->FocusChangeComplete(); | 801 agent_->FocusChangeComplete(); |
| 804 } | 802 } |
| 805 | 803 |
| 806 } // namespace autofill | 804 } // namespace autofill |
| OLD | NEW |