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/aw_permission_request.h" |
| 28 #include "android_webview/native/permission/permission_request_handler.h" |
27 #include "android_webview/native/state_serializer.h" | 29 #include "android_webview/native/state_serializer.h" |
28 #include "android_webview/public/browser/draw_gl.h" | 30 #include "android_webview/public/browser/draw_gl.h" |
29 #include "base/android/jni_android.h" | 31 #include "base/android/jni_android.h" |
30 #include "base/android/jni_array.h" | 32 #include "base/android/jni_array.h" |
31 #include "base/android/jni_string.h" | 33 #include "base/android/jni_string.h" |
32 #include "base/android/scoped_java_ref.h" | 34 #include "base/android/scoped_java_ref.h" |
33 #include "base/atomicops.h" | 35 #include "base/atomicops.h" |
34 #include "base/bind.h" | 36 #include "base/bind.h" |
35 #include "base/callback.h" | 37 #include "base/callback.h" |
36 #include "base/memory/memory_pressure_listener.h" | 38 #include "base/memory/memory_pressure_listener.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 web_contents_.get(), | 164 web_contents_.get(), |
163 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { | 165 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
164 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 166 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
165 icon_helper_.reset(new IconHelper(web_contents_.get())); | 167 icon_helper_.reset(new IconHelper(web_contents_.get())); |
166 icon_helper_->SetListener(this); | 168 icon_helper_->SetListener(this); |
167 web_contents_->SetUserData(kAwContentsUserDataKey, | 169 web_contents_->SetUserData(kAwContentsUserDataKey, |
168 new AwContentsUserData(this)); | 170 new AwContentsUserData(this)); |
169 render_view_host_ext_.reset( | 171 render_view_host_ext_.reset( |
170 new AwRenderViewHostExt(this, web_contents_.get())); | 172 new AwRenderViewHostExt(this, web_contents_.get())); |
171 | 173 |
| 174 permission_request_handler_.reset(new PermissionRequestHandler(this)); |
| 175 |
172 AwAutofillManagerDelegate* autofill_manager_delegate = | 176 AwAutofillManagerDelegate* autofill_manager_delegate = |
173 AwAutofillManagerDelegate::FromWebContents(web_contents_.get()); | 177 AwAutofillManagerDelegate::FromWebContents(web_contents_.get()); |
174 if (autofill_manager_delegate) | 178 if (autofill_manager_delegate) |
175 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); | 179 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); |
176 } | 180 } |
177 | 181 |
178 void AwContents::SetJavaPeers(JNIEnv* env, | 182 void AwContents::SetJavaPeers(JNIEnv* env, |
179 jobject obj, | 183 jobject obj, |
180 jobject aw_contents, | 184 jobject aw_contents, |
181 jobject web_contents_delegate, | 185 jobject web_contents_delegate, |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 "onGeolocationPermissionsHidePrompt"); | 516 "onGeolocationPermissionsHidePrompt"); |
513 Java_AwContents_onGeolocationPermissionsHidePrompt(env, j_ref.obj()); | 517 Java_AwContents_onGeolocationPermissionsHidePrompt(env, j_ref.obj()); |
514 } | 518 } |
515 if (!pending_geolocation_prompts_.empty()) { | 519 if (!pending_geolocation_prompts_.empty()) { |
516 ShowGeolocationPromptHelper(java_ref_, | 520 ShowGeolocationPromptHelper(java_ref_, |
517 pending_geolocation_prompts_.front().first); | 521 pending_geolocation_prompts_.front().first); |
518 } | 522 } |
519 } | 523 } |
520 } | 524 } |
521 | 525 |
| 526 void AwContents::OnPermissionRequest(AwPermissionRequest* request) { |
| 527 JNIEnv* env = AttachCurrentThread(); |
| 528 ScopedJavaLocalRef<jobject> j_request = request->GetJavaObject(); |
| 529 if (j_request.is_null()) |
| 530 return; |
| 531 |
| 532 ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env); |
| 533 Java_AwContents_onPermissionRequest(env, j_ref.obj(), j_request.obj()); |
| 534 } |
| 535 |
| 536 void AwContents::OnPermissionRequestCanceled(AwPermissionRequest* request) { |
| 537 JNIEnv* env = AttachCurrentThread(); |
| 538 ScopedJavaLocalRef<jobject> j_request = request->GetJavaObject(); |
| 539 if (j_request.is_null()) |
| 540 return; |
| 541 |
| 542 ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env); |
| 543 Java_AwContents_onPermissionRequestCanceled( |
| 544 env, j_ref.obj(), j_request.obj()); |
| 545 } |
| 546 |
522 void AwContents::FindAllAsync(JNIEnv* env, jobject obj, jstring search_string) { | 547 void AwContents::FindAllAsync(JNIEnv* env, jobject obj, jstring search_string) { |
523 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 548 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
524 GetFindHelper()->FindAllAsync(ConvertJavaStringToUTF16(env, search_string)); | 549 GetFindHelper()->FindAllAsync(ConvertJavaStringToUTF16(env, search_string)); |
525 } | 550 } |
526 | 551 |
527 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { | 552 void AwContents::FindNext(JNIEnv* env, jobject obj, jboolean forward) { |
528 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 553 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
529 GetFindHelper()->FindNext(forward); | 554 GetFindHelper()->FindNext(forward); |
530 } | 555 } |
531 | 556 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 | 1035 |
1011 void AwContents::ForceFakeComposite() { | 1036 void AwContents::ForceFakeComposite() { |
1012 browser_view_renderer_.ForceFakeCompositeSW(); | 1037 browser_view_renderer_.ForceFakeCompositeSW(); |
1013 } | 1038 } |
1014 | 1039 |
1015 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1040 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1016 g_should_download_favicons = true; | 1041 g_should_download_favicons = true; |
1017 } | 1042 } |
1018 | 1043 |
1019 } // namespace android_webview | 1044 } // namespace android_webview |
OLD | NEW |