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 PRINTING_PRINTING_CONTEXT_ANDROID_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_ANDROID_H_ |
6 #define PRINTING_PRINTING_CONTEXT_ANDROID_H_ | 6 #define PRINTING_PRINTING_CONTEXT_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "printing/printing_context.h" | 13 #include "printing/printing_context.h" |
14 | 14 |
15 namespace printing { | 15 namespace printing { |
16 | 16 |
17 // Android subclass of PrintingContext. This class communicates with the | 17 // Android subclass of PrintingContext. This class communicates with the |
18 // Java side through JNI. | 18 // Java side through JNI. |
19 class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext { | 19 class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext { |
20 public: | 20 public: |
21 explicit PrintingContextAndroid(Delegate* delegate); | 21 explicit PrintingContextAndroid(Delegate* delegate); |
22 ~PrintingContextAndroid() override; | 22 ~PrintingContextAndroid() override; |
23 | 23 |
24 // Called when the page is successfully written to a PDF using the file | 24 // Called when the page is successfully written to a PDF using the file |
25 // descriptor specified, or when the printing operation failed. | 25 // descriptor specified, or when the printing operation failed. |
26 static void PdfWritingDone(int fd, bool success); | 26 static void PdfWritingDone(int fd, bool success); |
27 | 27 |
28 // Called from Java, when printing settings from the user are ready or the | 28 // Called from Java, when printing settings from the user are ready or the |
29 // printing operation is canceled. | 29 // printing operation is canceled. |
30 void AskUserForSettingsReply(JNIEnv* env, jobject obj, jboolean success); | 30 void AskUserForSettingsReply(JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& obj, |
| 32 jboolean success); |
31 | 33 |
32 // Called from Java, when a printing process initiated by a script finishes. | 34 // Called from Java, when a printing process initiated by a script finishes. |
33 void ShowSystemDialogDone(JNIEnv* env, jobject obj); | 35 void ShowSystemDialogDone(JNIEnv* env, |
| 36 const base::android::JavaParamRef<jobject>& obj); |
34 | 37 |
35 // PrintingContext implementation. | 38 // PrintingContext implementation. |
36 void AskUserForSettings(int max_pages, | 39 void AskUserForSettings(int max_pages, |
37 bool has_selection, | 40 bool has_selection, |
38 bool is_scripted, | 41 bool is_scripted, |
39 const PrintSettingsCallback& callback) override; | 42 const PrintSettingsCallback& callback) override; |
40 Result UseDefaultSettings() override; | 43 Result UseDefaultSettings() override; |
41 gfx::Size GetPdfPaperSizeDeviceUnits() override; | 44 gfx::Size GetPdfPaperSizeDeviceUnits() override; |
42 Result UpdatePrinterSettings(bool external_preview, | 45 Result UpdatePrinterSettings(bool external_preview, |
43 bool show_system_dialog, | 46 bool show_system_dialog, |
(...skipping 17 matching lines...) Expand all Loading... |
61 // ready on the Java side | 64 // ready on the Java side |
62 PrintSettingsCallback callback_; | 65 PrintSettingsCallback callback_; |
63 | 66 |
64 DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid); | 67 DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace printing | 70 } // namespace printing |
68 | 71 |
69 #endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_ | 72 #endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_ |
70 | 73 |
OLD | NEW |