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 "android_webview/browser/renderer_host/print_manager.h" | 10 #include "android_webview/browser/renderer_host/print_manager.h" |
11 #include "base/android/jni_helper.h" | 11 #include "base/android/jni_helper.h" |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "skia/ext/refptr.h" | 15 #include "skia/ext/refptr.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 }; | 19 }; |
20 | 20 |
21 namespace printing { | 21 namespace printing { |
22 class PrintSettings; | 22 class PrintSettings; |
23 }; | 23 }; |
24 | 24 |
25 namespace android_webview { | 25 namespace android_webview { |
26 | 26 |
27 class BrowserViewRenderer; | |
28 | |
29 class AwPdfExporter : public PrintManagerDelegate { | 27 class AwPdfExporter : public PrintManagerDelegate { |
30 public: | 28 public: |
31 AwPdfExporter(JNIEnv* env, | 29 AwPdfExporter(JNIEnv* env, |
32 jobject obj, | 30 jobject obj, |
33 BrowserViewRenderer* view_renderer, | |
34 content::WebContents* web_contents); | 31 content::WebContents* web_contents); |
35 | 32 |
36 virtual ~AwPdfExporter(); | 33 virtual ~AwPdfExporter(); |
37 | 34 |
38 void ExportToPdf(JNIEnv* env, | 35 void ExportToPdf(JNIEnv* env, |
39 jobject obj, | 36 jobject obj, |
40 int fd, | 37 int fd, |
41 jobject cancel_signal); | 38 jobject cancel_signal); |
42 | 39 |
43 // Implement PrintManagerDelegate methods | 40 // Implement PrintManagerDelegate methods |
44 virtual void DidExportPdf(bool success) OVERRIDE; | 41 virtual void DidExportPdf(bool success) OVERRIDE; |
45 virtual bool IsCancelled() OVERRIDE; | 42 virtual bool IsCancelled() OVERRIDE; |
46 | 43 |
47 private: | 44 private: |
48 void CreatePdfSettings(JNIEnv* env, jobject obj); | 45 void CreatePdfSettings(JNIEnv* env, jobject obj); |
49 | 46 |
50 JavaObjectWeakGlobalRef java_ref_; | 47 JavaObjectWeakGlobalRef java_ref_; |
51 BrowserViewRenderer* view_renderer_; | |
52 content::WebContents* web_contents_; | 48 content::WebContents* web_contents_; |
53 | 49 |
54 scoped_ptr<PrintManager> print_manager_; | 50 scoped_ptr<PrintManager> print_manager_; |
55 scoped_ptr<printing::PrintSettings> print_settings_; | 51 scoped_ptr<printing::PrintSettings> print_settings_; |
56 | 52 |
57 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); | 53 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter); |
58 }; | 54 }; |
59 | 55 |
60 bool RegisterAwPdfExporter(JNIEnv* env); | 56 bool RegisterAwPdfExporter(JNIEnv* env); |
61 | 57 |
62 } // namespace android_webview | 58 } // namespace android_webview |
63 | 59 |
64 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ | 60 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_ |
OLD | NEW |