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/gpu_memory_buffer_factory_impl.h" | 11 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" |
12 #include "android_webview/browser/in_process_view_renderer.h" | 12 #include "android_webview/browser/in_process_view_renderer.h" |
13 #include "android_webview/browser/net_disk_cache_remover.h" | 13 #include "android_webview/browser/net_disk_cache_remover.h" |
14 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 14 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
15 #include "android_webview/common/aw_hit_test_data.h" | 15 #include "android_webview/common/aw_hit_test_data.h" |
16 #include "android_webview/native/aw_autofill_manager_delegate.h" | 16 #include "android_webview/native/aw_autofill_manager_delegate.h" |
17 #include "android_webview/native/aw_browser_dependency_factory.h" | 17 #include "android_webview/native/aw_browser_dependency_factory.h" |
18 #include "android_webview/native/aw_contents_client_bridge.h" | 18 #include "android_webview/native/aw_contents_client_bridge.h" |
19 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 19 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 20 #include "android_webview/native/aw_pdf_exporter.h" |
20 #include "android_webview/native/aw_picture.h" | 21 #include "android_webview/native/aw_picture.h" |
21 #include "android_webview/native/aw_web_contents_delegate.h" | 22 #include "android_webview/native/aw_web_contents_delegate.h" |
22 #include "android_webview/native/java_browser_view_renderer_helper.h" | 23 #include "android_webview/native/java_browser_view_renderer_helper.h" |
23 #include "android_webview/native/state_serializer.h" | 24 #include "android_webview/native/state_serializer.h" |
24 #include "android_webview/public/browser/draw_gl.h" | 25 #include "android_webview/public/browser/draw_gl.h" |
25 #include "base/android/jni_android.h" | 26 #include "base/android/jni_android.h" |
26 #include "base/android/jni_array.h" | 27 #include "base/android/jni_array.h" |
27 #include "base/android/jni_string.h" | 28 #include "base/android/jni_string.h" |
28 #include "base/android/scoped_java_ref.h" | 29 #include "base/android/scoped_java_ref.h" |
29 #include "base/atomicops.h" | 30 #include "base/atomicops.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 jstring jpath, jobject callback) { | 388 jstring jpath, jobject callback) { |
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
389 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 390 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
390 j_callback->Reset(env, callback); | 391 j_callback->Reset(env, callback); |
391 base::FilePath target_path(ConvertJavaStringToUTF8(env, jpath)); | 392 base::FilePath target_path(ConvertJavaStringToUTF8(env, jpath)); |
392 web_contents_->GenerateMHTML( | 393 web_contents_->GenerateMHTML( |
393 target_path, | 394 target_path, |
394 base::Bind(&GenerateMHTMLCallback, base::Owned(j_callback), target_path)); | 395 base::Bind(&GenerateMHTMLCallback, base::Owned(j_callback), target_path)); |
395 } | 396 } |
396 | 397 |
| 398 void AwContents::CreatePdfExporter(JNIEnv* env, |
| 399 jobject obj, |
| 400 jobject pdfExporter) { |
| 401 pdf_exporter_.reset( |
| 402 new AwPdfExporter(env, |
| 403 pdfExporter, |
| 404 browser_view_renderer_.get(), |
| 405 web_contents_.get())); |
| 406 } |
| 407 |
397 bool AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, | 408 bool AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, |
398 const std::string& host, | 409 const std::string& host, |
399 const std::string& realm) { | 410 const std::string& realm) { |
400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
401 JNIEnv* env = AttachCurrentThread(); | 412 JNIEnv* env = AttachCurrentThread(); |
402 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 413 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
403 if (obj.is_null()) | 414 if (obj.is_null()) |
404 return false; | 415 return false; |
405 | 416 |
406 ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); | 417 ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { | 981 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { |
971 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 982 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
972 browser_view_renderer_->TrimMemory(level); | 983 browser_view_renderer_->TrimMemory(level); |
973 } | 984 } |
974 | 985 |
975 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 986 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
976 g_should_download_favicons = true; | 987 g_should_download_favicons = true; |
977 } | 988 } |
978 | 989 |
979 } // namespace android_webview | 990 } // namespace android_webview |
OLD | NEW |