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

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: Rebase and update code as per Ilya's comments 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 b39ceb2077ce7850779ae530d6e551e83a6d3b86..0b32ff419817a4b2724da423c442d630eee5021a 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,
@@ -384,7 +386,7 @@ void AutofillAgent::AcceptDataListSuggestion(
new_value = JoinString(parts, ',');
}
- SetNodeText(new_value, &element_);
+ FillFieldWithValue(new_value, &element_);
}
void AutofillAgent::OnFieldTypePredictionsAvailable(
@@ -433,8 +435,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) {
@@ -567,10 +573,18 @@ 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()));
+ node->setAutofilled(true);
+}
+
+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() {
« 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