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.
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_
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"
25 namespace android_webview
{
27 class BrowserViewRenderer
;
29 class AwPdfExporter
: public PrintManagerDelegate
{
31 AwPdfExporter(JNIEnv
* env
,
33 BrowserViewRenderer
* view_renderer
,
34 content::WebContents
* web_contents
);
36 virtual ~AwPdfExporter();
38 void ExportToPdf(JNIEnv
* env
,
41 jobject cancel_signal
);
43 // Implement PrintManagerDelegate methods
44 virtual void DidExportPdf(bool success
) OVERRIDE
;
45 virtual bool IsCancelled() OVERRIDE
;
48 void CreatePdfSettings(JNIEnv
* env
, jobject obj
);
50 JavaObjectWeakGlobalRef java_ref_
;
51 BrowserViewRenderer
* view_renderer_
;
52 content::WebContents
* web_contents_
;
54 scoped_ptr
<PrintManager
> print_manager_
;
55 scoped_ptr
<printing::PrintSettings
> print_settings_
;
57 DISALLOW_COPY_AND_ASSIGN(AwPdfExporter
);
60 bool RegisterAwPdfExporter(JNIEnv
* env
);
62 } // namespace android_webview
64 #endif // ANDROID_WEBVIEW_NATIVE_AW_PDF_EXPORTER_H_