Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 148413002: Add "previewing on hover" support for single-field autocomplete input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ilya's 2nd set comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 16849bb439fc835c91e3c80b6769293d8077fcb1..14e5482a51f2a0a53696d43fda1d33f63c877af0 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -150,7 +150,9 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionPreview,
OnSetAutofillActionPreview)
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,
@@ -392,7 +394,7 @@ void AutofillAgent::AcceptDataListSuggestion(
new_value = JoinString(parts, ',');
}
- SetNodeText(new_value, &element_);
+ FillFieldWithValue(new_value, &element_);
}
void AutofillAgent::OnFormDataFilled(int query_id,
@@ -453,8 +455,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_);
Ilya Sherman 2014/03/01 02:57:37 nit: Why not just inline the code?
ziran.sun 2014/03/04 15:30:19 Sorry, which part code you are referring to?
}
void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) {
@@ -610,12 +616,19 @@ void AutofillAgent::FillAutofillFormData(const WebNode& node,
routing_id(), autofill_query_id_, form, field, unique_id));
}
-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()));
}
+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;

Powered by Google App Engine
This is Rietveld 408576698