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 #ifndef ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 }; | 16 }; |
17 | 17 |
18 namespace printing { | 18 namespace printing { |
19 class PrintSettings; | 19 class PrintSettings; |
20 }; | 20 }; |
21 | 21 |
22 namespace android_webview { | 22 namespace android_webview { |
23 | 23 |
24 class AwPdfExporter { | 24 class AwPdfExporter { |
25 public: | 25 public: |
26 AwPdfExporter(JNIEnv* env, | 26 AwPdfExporter(JNIEnv* env, |
27 jobject obj, | 27 const base::android::JavaRef<jobject>& obj, |
28 content::WebContents* web_contents); | 28 content::WebContents* web_contents); |
29 | 29 |
30 ~AwPdfExporter(); | 30 ~AwPdfExporter(); |
31 | 31 |
32 void ExportToPdf(JNIEnv* env, | 32 void ExportToPdf(JNIEnv* env, |
33 const base::android::JavaParamRef<jobject>& obj, | 33 const base::android::JavaParamRef<jobject>& obj, |
34 int fd, | 34 int fd, |
35 const base::android::JavaParamRef<jobject>& cancel_signal); | 35 const base::android::JavaParamRef<jobject>& cancel_signal); |
36 | 36 |
37 private: | 37 private: |
38 void InitPdfSettings(JNIEnv* env, | 38 void InitPdfSettings(JNIEnv* env, |
39 jobject obj, | 39 const base::android::JavaRef<jobject>& obj, |
40 printing::PrintSettings& settings); | 40 printing::PrintSettings& settings); |
41 void DidExportPdf(int fd, bool success); | 41 void DidExportPdf(int fd, bool success); |
42 | 42 |
43 JavaObjectWeakGlobalRef java_ref_; | 43 JavaObjectWeakGlobalRef java_ref_; |
44 content::WebContents* web_contents_; | 44 content::WebContents* web_contents_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); | 46 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); |
47 }; | 47 }; |
48 | 48 |
49 bool RegisterAwPdfExporter(JNIEnv* env); | 49 bool RegisterAwPdfExporter(JNIEnv* env); |
50 | 50 |
51 } // namespace android_webview | 51 } // namespace android_webview |
52 | 52 |
53 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ | 53 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ |
OLD | NEW |