Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 // If we didn't find the cached form, at least let autocomplete have a shot | 633 // If we didn't find the cached form, at least let autocomplete have a shot |
| 634 // at providing suggestions. | 634 // at providing suggestions. |
| 635 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); | 635 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); |
| 636 } | 636 } |
| 637 if (datalist_only) | 637 if (datalist_only) |
| 638 field.should_autocomplete = false; | 638 field.should_autocomplete = false; |
| 639 | 639 |
| 640 gfx::RectF bounding_box_scaled = | 640 gfx::RectF bounding_box_scaled = |
| 641 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); | 641 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); |
| 642 | 642 |
| 643 std::vector<base::string16> data_list_values; | |
| 644 std::vector<base::string16> data_list_labels; | |
| 643 const WebInputElement* input_element = toWebInputElement(&element); | 645 const WebInputElement* input_element = toWebInputElement(&element); |
| 644 if (input_element) { | 646 if (input_element) { |
| 645 // Find the datalist values and send them to the browser process. | 647 // Find the datalist values and send them to the browser process. |
| 646 std::vector<base::string16> data_list_values; | |
| 647 std::vector<base::string16> data_list_labels; | |
| 648 GetDataListSuggestions(*input_element, | 648 GetDataListSuggestions(*input_element, |
| 649 datalist_only, | 649 datalist_only, |
| 650 &data_list_values, | 650 &data_list_values, |
| 651 &data_list_labels); | 651 &data_list_labels); |
| 652 TrimStringVectorForIPC(&data_list_values); | 652 TrimStringVectorForIPC(&data_list_values); |
| 653 TrimStringVectorForIPC(&data_list_labels); | 653 TrimStringVectorForIPC(&data_list_labels); |
| 654 | |
| 655 Send(new AutofillHostMsg_SetDataList(routing_id(), | |
| 656 data_list_values, | |
| 657 data_list_labels)); | |
| 658 } | 654 } |
| 659 | 655 |
| 660 is_popup_possibly_visible_ = true; | 656 is_popup_possibly_visible_ = true; |
| 657 Send(new AutofillHostMsg_SetDataList(routing_id(), | |
| 658 data_list_values, | |
| 659 data_list_labels)); | |
|
Ilya Sherman
2014/04/29 20:29:30
Aha! This makes perfect sense -- we were showing
ziran.sun
2014/04/30 10:05:22
It might make sense to send one message rather tha
| |
| 660 | |
| 661 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(), | 661 Send(new AutofillHostMsg_QueryFormFieldAutofill(routing_id(), |
| 662 autofill_query_id_, | 662 autofill_query_id_, |
| 663 form, | 663 form, |
| 664 field, | 664 field, |
| 665 bounding_box_scaled, | 665 bounding_box_scaled, |
| 666 display_warning_if_disabled)); | 666 display_warning_if_disabled)); |
| 667 } | 667 } |
| 668 | 668 |
| 669 void AutofillAgent::FillFieldWithValue(const base::string16& value, | 669 void AutofillAgent::FillFieldWithValue(const base::string16& value, |
| 670 WebInputElement* node) { | 670 WebInputElement* node) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 700 // Only monitors dynamic forms created in the top frame. Dynamic forms | 700 // Only monitors dynamic forms created in the top frame. Dynamic forms |
| 701 // inserted in iframes are not captured yet. | 701 // inserted in iframes are not captured yet. |
| 702 if (frame && !frame->parent()) { | 702 if (frame && !frame->parent()) { |
| 703 password_autofill_agent_->OnDynamicFormsSeen(frame); | 703 password_autofill_agent_->OnDynamicFormsSeen(frame); |
| 704 return; | 704 return; |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 } | 707 } |
| 708 | 708 |
| 709 } // namespace autofill | 709 } // namespace autofill |
| OLD | NEW |