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 85f4fad689dba9c397ecd85020a124a18a65f86d..b4a6835394dc366f8f8ce7dd61b5c1441a0fe9ce 100644 |
| --- a/components/autofill/content/renderer/autofill_agent.cc |
| +++ b/components/autofill/content/renderer/autofill_agent.cc |
| @@ -150,6 +150,8 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| OnSetAutofillActionPreview) |
| IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) |
| IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText, OnSetNodeText) |
| + IPC_MESSAGE_HANDLER(AutofillMsg_PreviewAutoCompleteNode, |
| + OnPreviewAutoCompleteNode) |
| IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, |
| OnAcceptDataListSuggestion) |
| IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion, |
| @@ -442,6 +444,7 @@ void AutofillAgent::OnClearPreviewedForm() { |
| return; |
| ClearPreviewedFormWithElement(element_, was_query_node_autofilled_); |
| + element_.setSuggestedValue(WebString()); |
|
Ilya Sherman
2014/02/22 05:59:51
Hmm, is this line actually necessary? It seems li
ziran.sun
2014/02/27 15:38:11
Done.
|
| } else { |
| // TODO(isherman): There seem to be rare cases where this code *is* |
| // reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would |
| @@ -456,6 +459,10 @@ void AutofillAgent::OnSetNodeText(const base::string16& value) { |
| SetNodeText(value, &element_); |
| } |
| +void AutofillAgent::OnPreviewAutoCompleteNode(const base::string16& value) { |
| + PreviewAutoCompleteNode(value, &element_); |
|
Ilya Sherman
2014/02/22 05:59:51
nit: Why not just inline the implementation here?
ziran.sun
2014/02/27 15:38:11
Done.
|
| +} |
| + |
| void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) { |
| AcceptDataListSuggestion(value); |
| } |
| @@ -615,6 +622,14 @@ void AutofillAgent::SetNodeText(const base::string16& value, |
| node->setEditingValue(substring); |
| } |
| +void AutofillAgent::PreviewAutoCompleteNode(const base::string16& value, |
| + blink::WebInputElement* node) { |
| + base::string16 substring = value; |
| + substring = substring.substr(0, node->maxLength()); |
| + |
| + node->setSuggestedValue(substring); |
|
Ilya Sherman
2014/02/22 05:59:51
You should also set
was_query_node_autofilled_
Ilya Sherman
2014/02/22 05:59:51
Wow, the method you're cribbing from was needlessl
ziran.sun
2014/02/27 15:38:11
Done.
|
| +} |
| + |
| void AutofillAgent::HideAutofillUI() { |
| if (!element_.isNull()) |
| OnClearPreviewedForm(); |