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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would | 481 // reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would |
482 // understand those cases and fix the code to avoid them. However, so far I | 482 // understand those cases and fix the code to avoid them. However, so far I |
483 // have been unable to reproduce such a case locally. If you hit this | 483 // have been unable to reproduce such a case locally. If you hit this |
484 // NOTREACHED(), please file a bug against me. | 484 // NOTREACHED(), please file a bug against me. |
485 NOTREACHED(); | 485 NOTREACHED(); |
486 } | 486 } |
487 } | 487 } |
488 | 488 |
489 void AutofillAgent::OnFillFieldWithValue(const base::string16& value) { | 489 void AutofillAgent::OnFillFieldWithValue(const base::string16& value) { |
490 WebInputElement* input_element = toWebInputElement(&element_); | 490 WebInputElement* input_element = toWebInputElement(&element_); |
491 if (input_element) | 491 if (input_element) { |
492 FillFieldWithValue(value, input_element); | 492 FillFieldWithValue(value, input_element); |
| 493 input_element->setAutofilled(true); |
| 494 } |
493 } | 495 } |
494 | 496 |
495 void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) { | 497 void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) { |
496 WebInputElement* input_element = toWebInputElement(&element_); | 498 WebInputElement* input_element = toWebInputElement(&element_); |
497 if (input_element) | 499 if (input_element) |
498 PreviewFieldWithValue(value, input_element); | 500 PreviewFieldWithValue(value, input_element); |
499 } | 501 } |
500 | 502 |
501 void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { | 503 void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { |
502 AcceptDataListSuggestion(value); | 504 AcceptDataListSuggestion(value); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 form, | 669 form, |
668 field, | 670 field, |
669 bounding_box_scaled, | 671 bounding_box_scaled, |
670 display_warning_if_disabled)); | 672 display_warning_if_disabled)); |
671 } | 673 } |
672 | 674 |
673 void AutofillAgent::FillFieldWithValue(const base::string16& value, | 675 void AutofillAgent::FillFieldWithValue(const base::string16& value, |
674 WebInputElement* node) { | 676 WebInputElement* node) { |
675 did_set_node_text_ = true; | 677 did_set_node_text_ = true; |
676 node->setEditingValue(value.substr(0, node->maxLength())); | 678 node->setEditingValue(value.substr(0, node->maxLength())); |
677 node->setAutofilled(true); | |
678 } | 679 } |
679 | 680 |
680 void AutofillAgent::PreviewFieldWithValue(const base::string16& value, | 681 void AutofillAgent::PreviewFieldWithValue(const base::string16& value, |
681 WebInputElement* node) { | 682 WebInputElement* node) { |
682 was_query_node_autofilled_ = element_.isAutofilled(); | 683 was_query_node_autofilled_ = element_.isAutofilled(); |
683 node->setSuggestedValue(value.substr(0, node->maxLength())); | 684 node->setSuggestedValue(value.substr(0, node->maxLength())); |
684 node->setAutofilled(true); | 685 node->setAutofilled(true); |
685 node->setSelectionRange(node->value().length(), | 686 node->setSelectionRange(node->value().length(), |
686 node->suggestedValue().length()); | 687 node->suggestedValue().length()); |
687 } | 688 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 // parsed form. | 726 // parsed form. |
726 if (frame && !frame->parent() && !frame->isLoading()) { | 727 if (frame && !frame->parent() && !frame->isLoading()) { |
727 ProcessForms(*frame); | 728 ProcessForms(*frame); |
728 password_autofill_agent_->OnDynamicFormsSeen(frame); | 729 password_autofill_agent_->OnDynamicFormsSeen(frame); |
729 return; | 730 return; |
730 } | 731 } |
731 } | 732 } |
732 } | 733 } |
733 | 734 |
734 } // namespace autofill | 735 } // namespace autofill |
OLD | NEW |