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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 } | 602 } |
603 | 603 |
604 autofill_action_ = action; | 604 autofill_action_ = action; |
605 Send(new AutofillHostMsg_FillAutofillFormData( | 605 Send(new AutofillHostMsg_FillAutofillFormData( |
606 routing_id(), autofill_query_id_, form, field, unique_id)); | 606 routing_id(), autofill_query_id_, form, field, unique_id)); |
607 } | 607 } |
608 | 608 |
609 void AutofillAgent::SetNodeText(const base::string16& value, | 609 void AutofillAgent::SetNodeText(const base::string16& value, |
610 blink::WebInputElement* node) { | 610 blink::WebInputElement* node) { |
611 did_set_node_text_ = true; | 611 did_set_node_text_ = true; |
612 base::string16 substring = value; | 612 node->setEditingValue(value.substr(0, node->maxLength())); |
613 substring = substring.substr(0, node->maxLength()); | |
614 | |
615 node->setEditingValue(substring); | |
616 } | 613 } |
617 | 614 |
618 void AutofillAgent::HideAutofillUI() { | 615 void AutofillAgent::HideAutofillUI() { |
619 if (!element_.isNull()) | 616 if (!element_.isNull()) |
620 OnClearPreviewedForm(); | 617 OnClearPreviewedForm(); |
621 | 618 |
622 Send(new AutofillHostMsg_HideAutofillUI(routing_id())); | 619 Send(new AutofillHostMsg_HideAutofillUI(routing_id())); |
623 } | 620 } |
624 | 621 |
625 // TODO(isherman): Decide if we want to support non-password autofill with AJAX. | 622 // TODO(isherman): Decide if we want to support non-password autofill with AJAX. |
626 void AutofillAgent::didAssociateFormControls( | 623 void AutofillAgent::didAssociateFormControls( |
627 const blink::WebVector<blink::WebNode>& nodes) { | 624 const blink::WebVector<blink::WebNode>& nodes) { |
628 for (size_t i = 0; i < nodes.size(); ++i) { | 625 for (size_t i = 0; i < nodes.size(); ++i) { |
629 blink::WebFrame* frame = nodes[i].document().frame(); | 626 blink::WebFrame* frame = nodes[i].document().frame(); |
630 // Only monitors dynamic forms created in the top frame. Dynamic forms | 627 // Only monitors dynamic forms created in the top frame. Dynamic forms |
631 // inserted in iframes are not captured yet. | 628 // inserted in iframes are not captured yet. |
632 if (!frame->parent()) { | 629 if (!frame->parent()) { |
633 password_autofill_agent_->OnDynamicFormsSeen(frame); | 630 password_autofill_agent_->OnDynamicFormsSeen(frame); |
634 return; | 631 return; |
635 } | 632 } |
636 } | 633 } |
637 } | 634 } |
638 | 635 |
639 } // namespace autofill | 636 } // namespace autofill |
OLD | NEW |