| 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 <tuple> | 7 #include <tuple> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 FormData form; | 708 FormData form; |
| 709 FormFieldData field; | 709 FormFieldData field; |
| 710 if (!form_util::FindFormAndFieldForFormControlElement(element, &form, | 710 if (!form_util::FindFormAndFieldForFormControlElement(element, &form, |
| 711 &field)) { | 711 &field)) { |
| 712 // If we didn't find the cached form, at least let autocomplete have a shot | 712 // If we didn't find the cached form, at least let autocomplete have a shot |
| 713 // at providing suggestions. | 713 // at providing suggestions. |
| 714 WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field); | 714 WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field); |
| 715 } | 715 } |
| 716 | 716 |
| 717 gfx::RectF bounding_box_scaled = form_util::GetScaledBoundingBox( | |
| 718 render_frame()->GetRenderView()->GetWebView()->pageScaleFactor(), | |
| 719 &element_); | |
| 720 | |
| 721 std::vector<base::string16> data_list_values; | 717 std::vector<base::string16> data_list_values; |
| 722 std::vector<base::string16> data_list_labels; | 718 std::vector<base::string16> data_list_labels; |
| 723 const WebInputElement* input_element = toWebInputElement(&element); | 719 const WebInputElement* input_element = toWebInputElement(&element); |
| 724 if (input_element) { | 720 if (input_element) { |
| 725 // Find the datalist values and send them to the browser process. | 721 // Find the datalist values and send them to the browser process. |
| 726 GetDataListSuggestions(*input_element, | 722 GetDataListSuggestions(*input_element, |
| 727 &data_list_values, | 723 &data_list_values, |
| 728 &data_list_labels); | 724 &data_list_labels); |
| 729 TrimStringVectorForIPC(&data_list_values); | 725 TrimStringVectorForIPC(&data_list_values); |
| 730 TrimStringVectorForIPC(&data_list_labels); | 726 TrimStringVectorForIPC(&data_list_labels); |
| 731 } | 727 } |
| 732 | 728 |
| 733 is_popup_possibly_visible_ = true; | 729 is_popup_possibly_visible_ = true; |
| 734 Send(new AutofillHostMsg_SetDataList(routing_id(), | 730 Send(new AutofillHostMsg_SetDataList(routing_id(), |
| 735 data_list_values, | 731 data_list_values, |
| 736 data_list_labels)); | 732 data_list_labels)); |
| 737 | 733 |
| 738 Send(new AutofillHostMsg_QueryFormFieldAutofill( | 734 Send(new AutofillHostMsg_QueryFormFieldAutofill( |
| 739 routing_id(), autofill_query_id_, form, field, bounding_box_scaled)); | 735 routing_id(), autofill_query_id_, form, field, |
| 736 gfx::RectF(element_.boundsInViewport()))); |
| 740 } | 737 } |
| 741 | 738 |
| 742 void AutofillAgent::FillFieldWithValue(const base::string16& value, | 739 void AutofillAgent::FillFieldWithValue(const base::string16& value, |
| 743 WebInputElement* node) { | 740 WebInputElement* node) { |
| 744 base::AutoReset<bool> auto_reset(&ignore_text_changes_, true); | 741 base::AutoReset<bool> auto_reset(&ignore_text_changes_, true); |
| 745 node->setEditingValue(value.substr(0, node->maxLength())); | 742 node->setEditingValue(value.substr(0, node->maxLength())); |
| 746 } | 743 } |
| 747 | 744 |
| 748 void AutofillAgent::PreviewFieldWithValue(const base::string16& value, | 745 void AutofillAgent::PreviewFieldWithValue(const base::string16& value, |
| 749 WebInputElement* node) { | 746 WebInputElement* node) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 812 |
| 816 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 813 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 817 // No-op. Don't delete |this|. | 814 // No-op. Don't delete |this|. |
| 818 } | 815 } |
| 819 | 816 |
| 820 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 817 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 821 agent_->FocusChangeComplete(); | 818 agent_->FocusChangeComplete(); |
| 822 } | 819 } |
| 823 | 820 |
| 824 } // namespace autofill | 821 } // namespace autofill |
| OLD | NEW |