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

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: Update test code Created 6 years, 9 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 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;
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/core/browser/autofill_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698