OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/autofill_agent.h" | 5 #include "components/autofill/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.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 (!autofill_on_empty_values && value.isEmpty()) || | 795 (!autofill_on_empty_values && value.isEmpty()) || |
796 (requires_caret_at_end && | 796 (requires_caret_at_end && |
797 (element.selectionStart() != element.selectionEnd() || | 797 (element.selectionStart() != element.selectionEnd() || |
798 element.selectionEnd() != static_cast<int>(value.length())))) { | 798 element.selectionEnd() != static_cast<int>(value.length())))) { |
799 // Any popup currently showing is obsolete. | 799 // Any popup currently showing is obsolete. |
800 HideAutofillUi(); | 800 HideAutofillUi(); |
801 return; | 801 return; |
802 } | 802 } |
803 | 803 |
804 element_ = element; | 804 element_ = element; |
| 805 if (password_autofill_agent_->ShowSuggestions(element)) |
| 806 return; |
805 | 807 |
806 // If autocomplete is disabled at the form level, then we might want to show a | 808 // If autocomplete is disabled at the form level, then we might want to show a |
807 // warning in place of suggestions. However, if autocomplete is disabled | 809 // warning in place of suggestions. However, if autocomplete is disabled |
808 // specifically for this field, we never want to show a warning. Otherwise, | 810 // specifically for this field, we never want to show a warning. Otherwise, |
809 // we might interfere with custom popups (e.g. search suggestions) used by the | 811 // we might interfere with custom popups (e.g. search suggestions) used by the |
810 // website. Note that we cannot use the WebKit method element.autoComplete() | 812 // website. Note that we cannot use the WebKit method element.autoComplete() |
811 // as it does not allow us to distinguish the case where autocomplete is | 813 // as it does not allow us to distinguish the case where autocomplete is |
812 // disabled for *both* the element and for the form. | 814 // disabled for *both* the element and for the form. |
813 // Also, if the field has no name, then we won't have values. | 815 // Also, if the field has no name, then we won't have values. |
814 const string16 autocomplete_attribute = element.getAttribute("autocomplete"); | 816 const string16 autocomplete_attribute = element.getAttribute("autocomplete"); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 web_view->hidePopups(); | 926 web_view->hidePopups(); |
925 | 927 |
926 HideHostAutofillUi(); | 928 HideHostAutofillUi(); |
927 } | 929 } |
928 | 930 |
929 void AutofillAgent::HideHostAutofillUi() { | 931 void AutofillAgent::HideHostAutofillUi() { |
930 Send(new AutofillHostMsg_HideAutofillUi(routing_id())); | 932 Send(new AutofillHostMsg_HideAutofillUi(routing_id())); |
931 } | 933 } |
932 | 934 |
933 } // namespace autofill | 935 } // namespace autofill |
OLD | NEW |