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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
11 #include "android_webview/browser/aw_resource_context.h" | 11 #include "android_webview/browser/aw_resource_context.h" |
12 #include "android_webview/browser/browser_view_renderer.h" | 12 #include "android_webview/browser/browser_view_renderer.h" |
13 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" | 13 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
14 #include "android_webview/browser/hardware_renderer.h" | 14 #include "android_webview/browser/hardware_renderer.h" |
15 #include "android_webview/browser/net_disk_cache_remover.h" | 15 #include "android_webview/browser/net_disk_cache_remover.h" |
16 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" | 16 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" |
17 #include "android_webview/common/aw_hit_test_data.h" | 17 #include "android_webview/common/aw_hit_test_data.h" |
18 #include "android_webview/common/devtools_instrumentation.h" | 18 #include "android_webview/common/devtools_instrumentation.h" |
19 #include "android_webview/native/aw_autofill_manager_delegate.h" | 19 #include "android_webview/native/aw_autofill_manager_delegate.h" |
20 #include "android_webview/native/aw_browser_dependency_factory.h" | 20 #include "android_webview/native/aw_browser_dependency_factory.h" |
21 #include "android_webview/native/aw_contents_client_bridge.h" | 21 #include "android_webview/native/aw_contents_client_bridge.h" |
22 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 22 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
23 #include "android_webview/native/aw_pdf_exporter.h" | 23 #include "android_webview/native/aw_pdf_exporter.h" |
24 #include "android_webview/native/aw_picture.h" | 24 #include "android_webview/native/aw_picture.h" |
25 #include "android_webview/native/aw_web_contents_delegate.h" | 25 #include "android_webview/native/aw_web_contents_delegate.h" |
26 #include "android_webview/native/java_browser_view_renderer_helper.h" | 26 #include "android_webview/native/java_browser_view_renderer_helper.h" |
27 #include "android_webview/native/permission/permission_request_handler.h" | |
27 #include "android_webview/native/state_serializer.h" | 28 #include "android_webview/native/state_serializer.h" |
28 #include "android_webview/public/browser/draw_gl.h" | 29 #include "android_webview/public/browser/draw_gl.h" |
29 #include "base/android/jni_android.h" | 30 #include "base/android/jni_android.h" |
30 #include "base/android/jni_array.h" | 31 #include "base/android/jni_array.h" |
31 #include "base/android/jni_string.h" | 32 #include "base/android/jni_string.h" |
32 #include "base/android/scoped_java_ref.h" | 33 #include "base/android/scoped_java_ref.h" |
33 #include "base/atomicops.h" | 34 #include "base/atomicops.h" |
34 #include "base/bind.h" | 35 #include "base/bind.h" |
35 #include "base/callback.h" | 36 #include "base/callback.h" |
36 #include "base/memory/memory_pressure_listener.h" | 37 #include "base/memory/memory_pressure_listener.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 web_contents_.get(), | 198 web_contents_.get(), |
198 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { | 199 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
199 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 200 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
200 icon_helper_.reset(new IconHelper(web_contents_.get())); | 201 icon_helper_.reset(new IconHelper(web_contents_.get())); |
201 icon_helper_->SetListener(this); | 202 icon_helper_->SetListener(this); |
202 web_contents_->SetUserData(kAwContentsUserDataKey, | 203 web_contents_->SetUserData(kAwContentsUserDataKey, |
203 new AwContentsUserData(this)); | 204 new AwContentsUserData(this)); |
204 render_view_host_ext_.reset( | 205 render_view_host_ext_.reset( |
205 new AwRenderViewHostExt(this, web_contents_.get())); | 206 new AwRenderViewHostExt(this, web_contents_.get())); |
206 | 207 |
208 permission_request_handler_.reset(new PermissionRequestHandler(this)); | |
209 | |
207 AwAutofillManagerDelegate* autofill_manager_delegate = | 210 AwAutofillManagerDelegate* autofill_manager_delegate = |
208 AwAutofillManagerDelegate::FromWebContents(web_contents_.get()); | 211 AwAutofillManagerDelegate::FromWebContents(web_contents_.get()); |
209 if (autofill_manager_delegate) | 212 if (autofill_manager_delegate) |
210 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); | 213 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); |
211 | 214 |
212 SetAndroidWebViewRendererPrefs(); | 215 SetAndroidWebViewRendererPrefs(); |
213 } | 216 } |
214 | 217 |
215 void AwContents::SetJavaPeers(JNIEnv* env, | 218 void AwContents::SetJavaPeers(JNIEnv* env, |
216 jobject obj, | 219 jobject obj, |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 "onGeolocationPermissionsHidePrompt"); | 573 "onGeolocationPermissionsHidePrompt"); |
571 Java_AwContents_onGeolocationPermissionsHidePrompt(env, j_ref.obj()); | 574 Java_AwContents_onGeolocationPermissionsHidePrompt(env, j_ref.obj()); |
572 } | 575 } |
573 if (!pending_geolocation_prompts_.empty()) { | 576 if (!pending_geolocation_prompts_.empty()) { |
574 ShowGeolocationPromptHelper(java_ref_, | 577 ShowGeolocationPromptHelper(java_ref_, |
575 pending_geolocation_prompts_.front().first); | 578 pending_geolocation_prompts_.front().first); |
576 } | 579 } |
577 } | 580 } |
578 } | 581 } |
579 | 582 |
583 void AwContents::OnPermissionRequest(ScopedJavaLocalRef<jobject> obj) { | |
benm (inactive)
2014/04/16 14:51:10
can we pass the native type into this function, an
michaelbai
2014/04/22 20:53:51
I were thinking passing in AwPermissionRequest req
| |
584 JNIEnv* env = AttachCurrentThread(); | |
585 ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env); | |
586 Java_AwContents_onPermissionRequest(env, j_ref.obj(), obj.obj()); | |
587 } | |
588 | |
589 void AwContents::OnPermissionRequestCanceled(ScopedJavaLocalRef<jobject> obj) { | |
590 JNIEnv* env = AttachCurrentThread(); | |
591 ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env); | |
592 Java_AwContents_onPermissionRequestCanceled(env, j_ref.obj(), obj.obj()); | |
593 } | |
594 | |
580 void AwContents::FindAllAsync(JNIEnv* env, jobject obj, jstring search_string) { | 595 void AwContents::FindAllAsync(JNIEnv* env, jobject obj, jstring search_string) { |
581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 596 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
582 GetFindHelper()->FindAllAsync(ConvertJavaStringToUTF16(env, search_string)); | 597 GetFindHelper()->FindAllAsync(ConvertJavaStringToUTF16(env, search_string)); |
583 } | 598 } |
584 | 599 |
585 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { | 600 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { |
586 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 601 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
587 GetFindHelper()->FindNext(forward); | 602 GetFindHelper()->FindNext(forward); |
588 } | 603 } |
589 | 604 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 | 1076 |
1062 void AwContents::ForceFakeComposite() { | 1077 void AwContents::ForceFakeComposite() { |
1063 browser_view_renderer_.ForceFakeCompositeSW(); | 1078 browser_view_renderer_.ForceFakeCompositeSW(); |
1064 } | 1079 } |
1065 | 1080 |
1066 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1081 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1067 g_should_download_favicons = true; | 1082 g_should_download_favicons = true; |
1068 } | 1083 } |
1069 | 1084 |
1070 } // namespace android_webview | 1085 } // namespace android_webview |
OLD | NEW |