Chromium Code Reviews| Index: components/autofill/content/renderer/autofill_agent.cc |
| diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc |
| index b36e8cef78d2e999a8a330e14fef8213f5df4997..fa564f2dc6887ee984eac83abae31f95c8c265a3 100644 |
| --- a/components/autofill/content/renderer/autofill_agent.cc |
| +++ b/components/autofill/content/renderer/autofill_agent.cc |
| @@ -148,7 +148,9 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| OnFieldTypePredictionsAvailable) |
| IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm) |
| IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) |
| - IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText, OnSetNodeText) |
| + IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) |
| + IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, |
| + OnPreviewFieldWithValue) |
| IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, |
| OnAcceptDataListSuggestion) |
| IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion, |
| @@ -389,7 +391,7 @@ void AutofillAgent::AcceptDataListSuggestion( |
| new_value = JoinString(parts, ','); |
| } |
| - SetNodeText(new_value, &element_); |
| + FillFieldWithValue(new_value, &element_); |
| } |
| void AutofillAgent::OnFieldTypePredictionsAvailable( |
| @@ -438,8 +440,12 @@ void AutofillAgent::OnClearPreviewedForm() { |
| } |
| } |
| -void AutofillAgent::OnSetNodeText(const base::string16& value) { |
| - SetNodeText(value, &element_); |
| +void AutofillAgent::OnFillFieldWithValue(const base::string16& value) { |
| + FillFieldWithValue(value, &element_); |
| +} |
| + |
| +void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) { |
| + PreviewFieldWithValue(value, &element_); |
| } |
| void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { |
| @@ -572,12 +578,19 @@ void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element, |
| display_warning_if_disabled)); |
| } |
| -void AutofillAgent::SetNodeText(const base::string16& value, |
| - blink::WebInputElement* node) { |
| +void AutofillAgent::FillFieldWithValue(const base::string16& value, |
| + blink::WebInputElement* node) { |
| did_set_node_text_ = true; |
| node->setEditingValue(value.substr(0, node->maxLength())); |
|
Ilya Sherman
2014/03/14 07:17:05
Let's call setAutofilled() here too, so that the y
ziran.sun
2014/03/14 13:50:57
Done.
|
| } |
| +void AutofillAgent::PreviewFieldWithValue(const base::string16& value, |
| + blink::WebInputElement* node) { |
| + was_query_node_autofilled_ = element_.isAutofilled(); |
| + node->setSuggestedValue(value.substr(0, node->maxLength())); |
| + node->setAutofilled(true); |
| +} |
| + |
| void AutofillAgent::HidePopup() { |
| if (!is_popup_possibly_visible_) |
| return; |