| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void AutofillAgent::Shutdown() { | 284 void AutofillAgent::Shutdown() { |
| 285 legacy_.Shutdown(); | 285 legacy_.Shutdown(); |
| 286 weak_ptr_factory_.InvalidateWeakPtrs(); | 286 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void AutofillAgent::FocusChangeComplete() { | 289 void AutofillAgent::FocusChangeComplete() { |
| 290 WebDocument doc = render_frame()->GetWebFrame()->document(); | 290 WebDocument doc = render_frame()->GetWebFrame()->document(); |
| 291 WebElement focused_element; | 291 WebElement focused_element; |
| 292 if (!doc.isNull()) | 292 if (!doc.isNull()) |
| 293 focused_element = doc.focusedElement(); | 293 focused_element = doc.focusedElement(); |
| 294 | 294 if (!focused_element.isNull()) { |
| 295 if (!focused_element.isNull() && password_generation_agent_ && | 295 if (password_generation_agent_ && |
| 296 password_generation_agent_->FocusedNodeHasChanged(focused_element)) { | 296 password_generation_agent_->FocusedNodeHasChanged(focused_element)) { |
| 297 is_generation_popup_possibly_visible_ = true; | 297 is_generation_popup_possibly_visible_ = true; |
| 298 is_popup_possibly_visible_ = true; | 298 is_popup_possibly_visible_ = true; |
| 299 } |
| 300 if (password_autofill_agent_) |
| 301 password_autofill_agent_->FocusedNodeHasChanged(focused_element); |
| 299 } | 302 } |
| 300 } | 303 } |
| 301 | 304 |
| 302 void AutofillAgent::setIgnoreTextChanges(bool ignore) { | 305 void AutofillAgent::setIgnoreTextChanges(bool ignore) { |
| 303 ignore_text_changes_ = ignore; | 306 ignore_text_changes_ = ignore; |
| 304 } | 307 } |
| 305 | 308 |
| 306 void AutofillAgent::FormControlElementClicked( | 309 void AutofillAgent::FormControlElementClicked( |
| 307 const WebFormControlElement& element, | 310 const WebFormControlElement& element, |
| 308 bool was_focused) { | 311 bool was_focused) { |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 692 |
| 690 static int query_counter = 0; | 693 static int query_counter = 0; |
| 691 autofill_query_id_ = query_counter++; | 694 autofill_query_id_ = query_counter++; |
| 692 | 695 |
| 693 FormData form; | 696 FormData form; |
| 694 FormFieldData field; | 697 FormFieldData field; |
| 695 if (!form_util::FindFormAndFieldForFormControlElement(element, &form, | 698 if (!form_util::FindFormAndFieldForFormControlElement(element, &form, |
| 696 &field)) { | 699 &field)) { |
| 697 // If we didn't find the cached form, at least let autocomplete have a shot | 700 // If we didn't find the cached form, at least let autocomplete have a shot |
| 698 // at providing suggestions. | 701 // at providing suggestions. |
| 699 WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field); | 702 WebFormControlElementToFormField(element, nullptr, form_util::EXTRACT_VALUE, |
| 703 &field); |
| 700 } | 704 } |
| 701 | 705 |
| 702 std::vector<base::string16> data_list_values; | 706 std::vector<base::string16> data_list_values; |
| 703 std::vector<base::string16> data_list_labels; | 707 std::vector<base::string16> data_list_labels; |
| 704 const WebInputElement* input_element = toWebInputElement(&element); | 708 const WebInputElement* input_element = toWebInputElement(&element); |
| 705 if (input_element) { | 709 if (input_element) { |
| 706 // Find the datalist values and send them to the browser process. | 710 // Find the datalist values and send them to the browser process. |
| 707 GetDataListSuggestions(*input_element, | 711 GetDataListSuggestions(*input_element, |
| 708 &data_list_values, | 712 &data_list_values, |
| 709 &data_list_labels); | 713 &data_list_labels); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 815 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 812 // No-op. Don't delete |this|. | 816 // No-op. Don't delete |this|. |
| 813 } | 817 } |
| 814 | 818 |
| 815 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 819 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 816 if (agent_) | 820 if (agent_) |
| 817 agent_->FocusChangeComplete(); | 821 agent_->FocusChangeComplete(); |
| 818 } | 822 } |
| 819 | 823 |
| 820 } // namespace autofill | 824 } // namespace autofill |
| OLD | NEW |