| 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. The implementation for this header file | 17 // Android subclass of PrintingContext. The implementation for this header file |
| 18 // resides in Chrome for Android repository. This class communicates with the | 18 // resides in Chrome for Android repository. This class communicates with the |
| 19 // Java side through JNI. | 19 // Java side through JNI. |
| 20 class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext { | 20 class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext { |
| 21 public: | 21 public: |
| 22 explicit PrintingContextAndroid(Delegate* delegate); | 22 explicit PrintingContextAndroid(const std::string& app_locale); |
| 23 virtual ~PrintingContextAndroid(); | 23 virtual ~PrintingContextAndroid(); |
| 24 | 24 |
| 25 // Called when the page is successfully written to a PDF using the file | 25 // Called when the page is successfully written to a PDF using the file |
| 26 // descriptor specified, or when the printing operation failed. | 26 // descriptor specified, or when the printing operation failed. |
| 27 static void PdfWritingDone(int fd, bool success); | 27 static void PdfWritingDone(int fd, bool success); |
| 28 | 28 |
| 29 // Called from Java, when printing settings from the user are ready or the | 29 // Called from Java, when printing settings from the user are ready or the |
| 30 // printing operation is canceled. | 30 // printing operation is canceled. |
| 31 void AskUserForSettingsReply(JNIEnv* env, jobject obj, jboolean success); | 31 void AskUserForSettingsReply(JNIEnv* env, jobject obj, jboolean success); |
| 32 | 32 |
| 33 // PrintingContext implementation. | 33 // PrintingContext implementation. |
| 34 virtual void AskUserForSettings( | 34 virtual void AskUserForSettings( |
| 35 gfx::NativeView parent_view, |
| 35 int max_pages, | 36 int max_pages, |
| 36 bool has_selection, | 37 bool has_selection, |
| 37 const PrintSettingsCallback& callback) OVERRIDE; | 38 const PrintSettingsCallback& callback) OVERRIDE; |
| 38 virtual Result UseDefaultSettings() OVERRIDE; | 39 virtual Result UseDefaultSettings() OVERRIDE; |
| 39 virtual gfx::Size GetPdfPaperSizeDeviceUnits() OVERRIDE; | 40 virtual gfx::Size GetPdfPaperSizeDeviceUnits() OVERRIDE; |
| 40 virtual Result UpdatePrinterSettings(bool external_preview) OVERRIDE; | 41 virtual Result UpdatePrinterSettings(bool external_preview) OVERRIDE; |
| 41 virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE; | 42 virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE; |
| 42 virtual Result NewDocument(const base::string16& document_name) OVERRIDE; | 43 virtual Result NewDocument(const base::string16& document_name) OVERRIDE; |
| 43 virtual Result NewPage() OVERRIDE; | 44 virtual Result NewPage() OVERRIDE; |
| 44 virtual Result PageDone() OVERRIDE; | 45 virtual Result PageDone() OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 // ready on the Java side | 58 // ready on the Java side |
| 58 PrintSettingsCallback callback_; | 59 PrintSettingsCallback callback_; |
| 59 | 60 |
| 60 DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid); | 61 DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace printing | 64 } // namespace printing |
| 64 | 65 |
| 65 #endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_ | 66 #endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_ |
| 66 | 67 |
| OLD | NEW |