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

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

Issue 2024603002: [Autofill] Register AutofillDriver mojo interface earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot failure Created 4 years, 7 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/content_autofill_driver_factory.cc
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.cc b/components/autofill/content/browser/content_autofill_driver_factory.cc
index f6860573437b413f3fd36c2798b29faffa5a8487..3e614dcb94aa25f97da20c43108472d90b863315 100644
--- a/components/autofill/content/browser/content_autofill_driver_factory.cc
+++ b/components/autofill/content/browser/content_autofill_driver_factory.cc
@@ -55,6 +55,30 @@ ContentAutofillDriverFactory* ContentAutofillDriverFactory::FromWebContents(
kContentAutofillDriverFactoryWebContentsUserDataKey));
}
+// static
+void ContentAutofillDriverFactory::BindAutofillDriver(
+ content::RenderFrameHost* render_frame_host,
+ mojom::AutofillDriverRequest request) {
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host);
+ // We try to bind to the driver of this render frame host,
+ // but if driver is not ready for this render frame host for now,
+ // the request will be just dropped, this would cause closing the message pipe
+ // which would raise connection error to peer side.
+ // Peer side could reconnect later when needed.
+ if (!web_contents)
+ return;
+
+ ContentAutofillDriverFactory* factory =
+ ContentAutofillDriverFactory::FromWebContents(web_contents);
+ if (!factory)
+ return;
+
+ ContentAutofillDriver* driver = factory->DriverForFrame(render_frame_host);
+ if (driver)
+ driver->BindRequest(std::move(request));
+}
+
ContentAutofillDriverFactory::ContentAutofillDriverFactory(
content::WebContents* web_contents,
AutofillClient* client,

Powered by Google App Engine
This is Rietveld 408576698