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

Unified Diff: chrome/renderer/autofill/autofill_agent.cc

Issue 11270018: [autofill] Adding new API to request an interactive autocomplete UI flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: do a barrel roll! Created 8 years, 2 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: chrome/renderer/autofill/autofill_agent.cc
diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
index 3977caae7a9ab189390c0b0e182b6885247eba68..8a58ae63852cc83bdc3861ff9f9a5d942414fdee 100644
--- a/chrome/renderer/autofill/autofill_agent.cc
+++ b/chrome/renderer/autofill/autofill_agent.cc
@@ -159,6 +159,8 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
OnAcceptDataListSuggestion)
IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion,
OnAcceptPasswordAutofillSuggestion)
+ IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteFinished,
+ OnRequestAutocompleteFinished)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -213,6 +215,25 @@ void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) {
Send(new AutofillHostMsg_HideAutofillPopup(routing_id()));
}
+void AutofillAgent::RequestAutocomplete(WebKit::WebFrame* frame,
+ const WebFormElement& form) {
+
+ // TODO(dbeam): should popups be hidden here? Maybe after a view message from
+ // the browser to say whether the interactive autocomplete UI will show?
Ilya Sherman 2012/10/26 03:30:52 Yes, we should hide popups and cancel any pending
Dan Beam 2012/10/26 05:51:44 creating separate counter for this request like we
+
+ FormData form_data;
+ if (WebFormElementToFormData(form,
+ WebFormControlElement(),
+ REQUIRE_AUTOCOMPLETE,
+ static_cast<ExtractMask>(
+ EXTRACT_VALUE | EXTRACT_OPTION_TEXT),
Ilya Sherman 2012/10/26 03:30:52 nit: I don't think we need to extract values or op
Dan Beam 2012/10/26 05:51:44 Done.
+ &form_data,
+ NULL)) {
+ form_ = form;
+ Send(new AutofillHostMsg_RequestAutocomplete(routing_id(), form_data));
+ }
+}
+
bool AutofillAgent::InputElementClicked(const WebInputElement& element,
bool was_focused,
bool is_focused) {
@@ -582,6 +603,10 @@ void AutofillAgent::OnAcceptPasswordAutofillSuggestion(const string16& value) {
DCHECK(handled);
}
+void AutofillAgent::OnRequestAutocompleteFinished(bool success) {
+ form_.dispatchAutocompleteEvent(success);
Ilya Sherman 2012/10/26 03:30:52 We should do some sort of checking here to make su
Dan Beam 2012/10/26 05:51:44 why would it being removed from the DOM cause us t
+}
+
void AutofillAgent::ShowSuggestions(const WebInputElement& element,
bool autofill_on_empty_values,
bool requires_caret_at_end,

Powered by Google App Engine
This is Rietveld 408576698