| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_pdf_exporter.h" | 5 #include "android_webview/native/aw_pdf_exporter.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/browser_view_renderer.h" | |
| 8 #include "android_webview/browser/renderer_host/print_manager.h" | 7 #include "android_webview/browser/renderer_host/print_manager.h" |
| 9 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 10 #include "base/logging.h" | 9 #include "base/logging.h" |
| 11 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 13 #include "jni/AwPdfExporter_jni.h" | 12 #include "jni/AwPdfExporter_jni.h" |
| 14 #include "printing/print_settings.h" | 13 #include "printing/print_settings.h" |
| 15 #include "printing/units.h" | 14 #include "printing/units.h" |
| 16 | 15 |
| 17 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
| 18 using base::android::ScopedJavaGlobalRef; | 17 using base::android::ScopedJavaGlobalRef; |
| 19 using content::BrowserThread; | 18 using content::BrowserThread; |
| 20 using content::WebContents; | 19 using content::WebContents; |
| 21 using printing::ConvertUnitDouble; | 20 using printing::ConvertUnitDouble; |
| 22 using printing::PageMargins; | 21 using printing::PageMargins; |
| 23 using printing::PrintSettings; | 22 using printing::PrintSettings; |
| 24 | 23 |
| 25 namespace android_webview { | 24 namespace android_webview { |
| 26 | 25 |
| 27 AwPdfExporter::AwPdfExporter(JNIEnv* env, | 26 AwPdfExporter::AwPdfExporter(JNIEnv* env, |
| 28 jobject obj, | 27 jobject obj, |
| 29 BrowserViewRenderer* view_renderer, | |
| 30 WebContents* web_contents) | 28 WebContents* web_contents) |
| 31 : java_ref_(env, obj), | 29 : java_ref_(env, obj), |
| 32 view_renderer_(view_renderer), | |
| 33 web_contents_(web_contents) { | 30 web_contents_(web_contents) { |
| 34 DCHECK(obj); | 31 DCHECK(obj); |
| 35 Java_AwPdfExporter_setNativeAwPdfExporter( | 32 Java_AwPdfExporter_setNativeAwPdfExporter( |
| 36 env, obj, reinterpret_cast<jint>(this)); | 33 env, obj, reinterpret_cast<jint>(this)); |
| 37 } | 34 } |
| 38 | 35 |
| 39 AwPdfExporter::~AwPdfExporter() { | 36 AwPdfExporter::~AwPdfExporter() { |
| 40 JNIEnv* env = AttachCurrentThread(); | 37 JNIEnv* env = AttachCurrentThread(); |
| 41 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 38 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 42 if (obj.is_null()) | 39 if (obj.is_null()) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // TODO(sgurun) implement. Needs connecting with the |cancel_signal| passed | 108 // TODO(sgurun) implement. Needs connecting with the |cancel_signal| passed |
| 112 // in the constructor. | 109 // in the constructor. |
| 113 return false; | 110 return false; |
| 114 } | 111 } |
| 115 | 112 |
| 116 bool RegisterAwPdfExporter(JNIEnv* env) { | 113 bool RegisterAwPdfExporter(JNIEnv* env) { |
| 117 return RegisterNativesImpl(env) >= 0; | 114 return RegisterNativesImpl(env) >= 0; |
| 118 } | 115 } |
| 119 | 116 |
| 120 } // namespace android_webview | 117 } // namespace android_webview |
| OLD | NEW |