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