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

Unified Diff: android_webview/native/aw_contents.cc

Issue 2745803003: autofill-try
Patch Set: before I leave Created 3 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: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 5d348686112afc1623dec547e209268a2db50412..191dc041b7d275703f9c5c491219e06aa1644c8e 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -52,6 +52,7 @@
#include "base/strings/string16.h"
#include "base/supports_user_data.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "components/autofill/content/browser/autofill_provider_android.h"
#include "components/autofill/content/browser/content_autofill_driver_factory.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
@@ -297,11 +298,22 @@ void AwContents::InitAutofillIfNecessary(bool enabled) {
if (ContentAutofillDriverFactory::FromWebContents(web_contents))
return;
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return;
+
+ jlong nativeAutofillProvider = Java_AwContents_getNativeAutofillAndroid(
+ env, obj);
+ autofill_provider_.reset(
+ reinterpret_cast<autofill::AutofillProvider*>(nativeAutofillProvider));
AwAutofillClient::CreateForWebContents(web_contents);
ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
web_contents, AwAutofillClient::FromWebContents(web_contents),
base::android::GetDefaultLocaleString(),
- AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
+ AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER,
+ autofill_provider_.get());
}
void AwContents::SetAwAutofillClient(const JavaRef<jobject>& client) {

Powered by Google App Engine
This is Rietveld 408576698