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

Unified Diff: components/autofill/content/browser/autofill_driver_impl.cc

Issue 18563002: Move SendAutofillTypePredictions() into AutofillDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/browser/autofill_driver_impl.cc
diff --git a/components/autofill/content/browser/autofill_driver_impl.cc b/components/autofill/content/browser/autofill_driver_impl.cc
index 2cc9c25567cc6e8d0589306f9d5f58dad90a7d76..c476a6963f4a93e67b20056b5378fc0b3ca65608 100644
--- a/components/autofill/content/browser/autofill_driver_impl.cc
+++ b/components/autofill/content/browser/autofill_driver_impl.cc
@@ -4,10 +4,13 @@
#include "components/autofill/content/browser/autofill_driver_impl.h"
+#include "base/command_line.h"
#include "components/autofill/core/browser/autofill_external_delegate.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_manager_delegate.h"
#include "components/autofill/core/common/autofill_messages.h"
+#include "components/autofill/core/browser/form_structure.h"
+#include "components/autofill/core/common/autofill_switches.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/notification_service.h"
@@ -95,6 +98,23 @@ void AutofillDriverImpl::SendFormDataToRenderer(int query_id,
new AutofillMsg_FormDataFilled(host->GetRoutingID(), query_id, data));
}
+void AutofillDriverImpl::SendAutofillTypePredictionsToRenderer(
+ const std::vector<FormStructure*>& forms) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kShowAutofillTypePredictions))
+ return;
+
+ content::RenderViewHost* host = GetWebContents()->GetRenderViewHost();
+ if (!host)
+ return;
+
+ std::vector<FormDataPredictions> type_predictions;
+ FormStructure::GetFieldTypePredictions(forms, &type_predictions);
+ host->Send(
+ new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(),
+ type_predictions));
+}
+
bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AutofillDriverImpl, message)

Powered by Google App Engine
This is Rietveld 408576698