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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 2745803003: autofill-try
Patch Set: before I leave Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/browser/aw_browser_context.h" 10 #include "android_webview/browser/aw_browser_context.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "base/callback.h" 45 #include "base/callback.h"
46 #include "base/command_line.h" 46 #include "base/command_line.h"
47 #include "base/location.h" 47 #include "base/location.h"
48 #include "base/memory/memory_pressure_listener.h" 48 #include "base/memory/memory_pressure_listener.h"
49 #include "base/memory/ptr_util.h" 49 #include "base/memory/ptr_util.h"
50 #include "base/pickle.h" 50 #include "base/pickle.h"
51 #include "base/single_thread_task_runner.h" 51 #include "base/single_thread_task_runner.h"
52 #include "base/strings/string16.h" 52 #include "base/strings/string16.h"
53 #include "base/supports_user_data.h" 53 #include "base/supports_user_data.h"
54 #include "base/threading/thread_task_runner_handle.h" 54 #include "base/threading/thread_task_runner_handle.h"
55 #include "components/autofill/content/browser/autofill_provider_android.h"
55 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 56 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
56 #include "components/autofill/core/browser/autofill_manager.h" 57 #include "components/autofill/core/browser/autofill_manager.h"
57 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 58 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
58 #include "components/navigation_interception/intercept_navigation_delegate.h" 59 #include "components/navigation_interception/intercept_navigation_delegate.h"
59 #include "content/public/browser/android/content_view_core.h" 60 #include "content/public/browser/android/content_view_core.h"
60 #include "content/public/browser/android/synchronous_compositor.h" 61 #include "content/public/browser/android/synchronous_compositor.h"
61 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
62 #include "content/public/browser/child_process_security_policy.h" 63 #include "content/public/browser/child_process_security_policy.h"
63 #include "content/public/browser/favicon_status.h" 64 #include "content/public/browser/favicon_status.h"
64 #include "content/public/browser/interstitial_page.h" 65 #include "content/public/browser/interstitial_page.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 void AwContents::InitAutofillIfNecessary(bool enabled) { 292 void AwContents::InitAutofillIfNecessary(bool enabled) {
292 // Do not initialize if the feature is not enabled. 293 // Do not initialize if the feature is not enabled.
293 if (!enabled) 294 if (!enabled)
294 return; 295 return;
295 // Check if the autofill driver factory already exists. 296 // Check if the autofill driver factory already exists.
296 content::WebContents* web_contents = web_contents_.get(); 297 content::WebContents* web_contents = web_contents_.get();
297 if (ContentAutofillDriverFactory::FromWebContents(web_contents)) 298 if (ContentAutofillDriverFactory::FromWebContents(web_contents))
298 return; 299 return;
299 300
301 DCHECK_CURRENTLY_ON(BrowserThread::UI);
302 JNIEnv* env = AttachCurrentThread();
303 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
304 if (obj.is_null())
305 return;
306
307 jlong nativeAutofillProvider = Java_AwContents_getNativeAutofillAndroid(
308 env, obj);
309 autofill_provider_.reset(
310 reinterpret_cast<autofill::AutofillProvider*>(nativeAutofillProvider));
300 AwAutofillClient::CreateForWebContents(web_contents); 311 AwAutofillClient::CreateForWebContents(web_contents);
301 ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( 312 ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
302 web_contents, AwAutofillClient::FromWebContents(web_contents), 313 web_contents, AwAutofillClient::FromWebContents(web_contents),
303 base::android::GetDefaultLocaleString(), 314 base::android::GetDefaultLocaleString(),
304 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); 315 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER,
316 autofill_provider_.get());
305 } 317 }
306 318
307 void AwContents::SetAwAutofillClient(const JavaRef<jobject>& client) { 319 void AwContents::SetAwAutofillClient(const JavaRef<jobject>& client) {
308 DCHECK_CURRENTLY_ON(BrowserThread::UI); 320 DCHECK_CURRENTLY_ON(BrowserThread::UI);
309 JNIEnv* env = AttachCurrentThread(); 321 JNIEnv* env = AttachCurrentThread();
310 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 322 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
311 if (obj.is_null()) 323 if (obj.is_null())
312 return; 324 return;
313 Java_AwContents_setAwAutofillClient(env, obj, client); 325 Java_AwContents_setAwAutofillClient(env, obj, client);
314 } 326 }
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1461
1450 return Java_AwContents_onRenderProcessGoneDetail(env, obj, 1462 return Java_AwContents_onRenderProcessGoneDetail(env, obj,
1451 child_process_id, crashed); 1463 child_process_id, crashed);
1452 } 1464 }
1453 1465
1454 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { 1466 void AwContents::RenderProcessReady(content::RenderProcessHost* host) {
1455 UpdateRendererPriority(); 1467 UpdateRendererPriority();
1456 } 1468 }
1457 1469
1458 } // namespace android_webview 1470 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698