| OLD | NEW |
| 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 "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "android_webview/browser/aw_browser_main_parts.h" | 8 #include "android_webview/browser/aw_browser_main_parts.h" |
| 9 #include "android_webview/browser/gpu_memory_buffer_impl.h" | 9 #include "android_webview/browser/gpu_memory_buffer_impl.h" |
| 10 #include "android_webview/browser/in_process_view_renderer.h" | 10 #include "android_webview/browser/in_process_view_renderer.h" |
| 11 #include "android_webview/browser/net_disk_cache_remover.h" | 11 #include "android_webview/browser/net_disk_cache_remover.h" |
| 12 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 12 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
| 13 #include "android_webview/common/aw_hit_test_data.h" | 13 #include "android_webview/common/aw_hit_test_data.h" |
| 14 #include "android_webview/native/aw_autofill_manager_delegate.h" |
| 14 #include "android_webview/native/aw_browser_dependency_factory.h" | 15 #include "android_webview/native/aw_browser_dependency_factory.h" |
| 15 #include "android_webview/native/aw_contents_client_bridge.h" | 16 #include "android_webview/native/aw_contents_client_bridge.h" |
| 16 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 17 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 17 #include "android_webview/native/aw_web_contents_delegate.h" | 18 #include "android_webview/native/aw_web_contents_delegate.h" |
| 18 #include "android_webview/native/java_browser_view_renderer_helper.h" | 19 #include "android_webview/native/java_browser_view_renderer_helper.h" |
| 19 #include "android_webview/native/state_serializer.h" | 20 #include "android_webview/native/state_serializer.h" |
| 20 #include "android_webview/public/browser/draw_gl.h" | 21 #include "android_webview/public/browser/draw_gl.h" |
| 21 #include "base/android/jni_android.h" | 22 #include "base/android/jni_android.h" |
| 22 #include "base/android/jni_array.h" | 23 #include "base/android/jni_array.h" |
| 23 #include "base/android/jni_string.h" | 24 #include "base/android/jni_string.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (AutofillDriverImpl::FromWebContents(web_contents_.get())) { | 186 if (AutofillDriverImpl::FromWebContents(web_contents_.get())) { |
| 186 AwAutofillManagerDelegate::FromWebContents(web_contents_.get())-> | 187 AwAutofillManagerDelegate::FromWebContents(web_contents_.get())-> |
| 187 SetSaveFormData(enabled); | 188 SetSaveFormData(enabled); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 void AwContents::InitAutofillIfNecessary(bool enabled) { | 192 void AwContents::InitAutofillIfNecessary(bool enabled) { |
| 192 // Do not initialize if the feature is not enabled. | 193 // Do not initialize if the feature is not enabled. |
| 193 if (!enabled) | 194 if (!enabled) |
| 194 return; | 195 return; |
| 195 // Check if the autofill manager already exists. | 196 // Check if the autofill driver already exists. |
| 196 content::WebContents* web_contents = web_contents_.get(); | 197 content::WebContents* web_contents = web_contents_.get(); |
| 197 if (AutofillDriverImpl::FromWebContents(web_contents)) | 198 if (AutofillDriverImpl::FromWebContents(web_contents)) |
| 198 return; | 199 return; |
| 199 | 200 |
| 200 AwBrowserContext::FromWebContents(web_contents)-> | 201 AwBrowserContext::FromWebContents(web_contents)-> |
| 201 CreateUserPrefServiceIfNecessary(); | 202 CreateUserPrefServiceIfNecessary(); |
| 202 AwAutofillManagerDelegate::CreateForWebContents(web_contents); | 203 AwAutofillManagerDelegate::CreateForWebContents(web_contents); |
| 203 AutofillDriverImpl::CreateForWebContentsAndDelegate( | 204 AutofillDriverImpl::CreateForWebContentsAndDelegate( |
| 204 web_contents, | 205 web_contents, |
| 205 AwAutofillManagerDelegate::FromWebContents(web_contents), | 206 AwAutofillManagerDelegate::FromWebContents(web_contents), |
| 206 l10n_util::GetDefaultLocale(), | 207 l10n_util::GetDefaultLocale(), |
| 207 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); | 208 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); |
| 208 } | 209 } |
| 209 | 210 |
| 211 void AwContents::SetAwAutofillManagerDelegate(jobject delegate) { |
| 212 JNIEnv* env = AttachCurrentThread(); |
| 213 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 214 if (obj.is_null()) |
| 215 return; |
| 216 Java_AwContents_setAwAutofillManagerDelegate(env, obj.obj(), delegate); |
| 217 } |
| 218 |
| 210 AwContents::~AwContents() { | 219 AwContents::~AwContents() { |
| 211 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); | 220 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); |
| 212 web_contents_->RemoveUserData(kAwContentsUserDataKey); | 221 web_contents_->RemoveUserData(kAwContentsUserDataKey); |
| 213 if (find_helper_.get()) | 222 if (find_helper_.get()) |
| 214 find_helper_->SetListener(NULL); | 223 find_helper_->SetListener(NULL); |
| 215 if (icon_helper_.get()) | 224 if (icon_helper_.get()) |
| 216 icon_helper_->SetListener(NULL); | 225 icon_helper_->SetListener(NULL); |
| 217 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, -1); | 226 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, -1); |
| 218 } | 227 } |
| 219 | 228 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 return browser_view_renderer_->CapturePicture(); | 722 return browser_view_renderer_->CapturePicture(); |
| 714 } | 723 } |
| 715 | 724 |
| 716 void AwContents::EnableOnNewPicture(JNIEnv* env, | 725 void AwContents::EnableOnNewPicture(JNIEnv* env, |
| 717 jobject obj, | 726 jobject obj, |
| 718 jboolean enabled) { | 727 jboolean enabled) { |
| 719 browser_view_renderer_->EnableOnNewPicture(enabled); | 728 browser_view_renderer_->EnableOnNewPicture(enabled); |
| 720 } | 729 } |
| 721 | 730 |
| 722 } // namespace android_webview | 731 } // namespace android_webview |
| OLD | NEW |