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/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "skia/ext/refptr.h" | 13 #include "skia/ext/refptr.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 class WebContents; | 16 class WebContents; |
18 }; | 17 }; |
19 | 18 |
20 namespace printing { | 19 namespace printing { |
21 class PrintSettings; | 20 class PrintSettings; |
22 }; | 21 }; |
23 | 22 |
24 namespace android_webview { | 23 namespace android_webview { |
25 | 24 |
26 class AwPdfExporter { | 25 class AwPdfExporter { |
27 public: | 26 public: |
28 AwPdfExporter(JNIEnv* env, | 27 AwPdfExporter(JNIEnv* env, |
29 jobject obj, | 28 jobject obj, |
30 content::WebContents* web_contents); | 29 content::WebContents* web_contents); |
31 | 30 |
32 ~AwPdfExporter(); | 31 ~AwPdfExporter(); |
33 | 32 |
34 void ExportToPdf(JNIEnv* env, | 33 void ExportToPdf(JNIEnv* env, |
35 jobject obj, | 34 jobject obj, |
36 int fd, | 35 int fd, |
37 jobject cancel_signal); | 36 jobject cancel_signal); |
38 | 37 |
39 private: | 38 private: |
40 void CreatePdfSettings(JNIEnv* env, jobject obj); | 39 void InitPdfSettings(JNIEnv* env, |
| 40 jobject obj, |
| 41 printing::PrintSettings& settings); |
41 void DidExportPdf(int fd, bool success); | 42 void DidExportPdf(int fd, bool success); |
42 | 43 |
43 JavaObjectWeakGlobalRef java_ref_; | 44 JavaObjectWeakGlobalRef java_ref_; |
44 content::WebContents* web_contents_; | 45 content::WebContents* web_contents_; |
45 | 46 |
46 scoped_ptr<printing::PrintSettings> print_settings_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); | 47 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); |
49 }; | 48 }; |
50 | 49 |
51 bool RegisterAwPdfExporter(JNIEnv* env); | 50 bool RegisterAwPdfExporter(JNIEnv* env); |
52 | 51 |
53 } // namespace android_webview | 52 } // namespace android_webview |
54 | 53 |
55 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ | 54 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ |
OLD | NEW |