| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LINUX_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_LINUX_H_ |
| 6 #define PRINTING_PRINTING_CONTEXT_LINUX_H_ | 6 #define PRINTING_PRINTING_CONTEXT_LINUX_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "printing/printing_context.h" | 10 #include "printing/printing_context.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace printing { | 16 namespace printing { |
| 17 | 17 |
| 18 class MetafilePlayer; | 18 class MetafilePlayer; |
| 19 class PrintDialogGtkInterface; | 19 class PrintDialogGtkInterface; |
| 20 | 20 |
| 21 // PrintingContext with optional native UI for print dialog and pdf_paper_size. | 21 // PrintingContext with optional native UI for print dialog and pdf_paper_size. |
| 22 class PRINTING_EXPORT PrintingContextLinux : public PrintingContext { | 22 class PRINTING_EXPORT PrintingContextLinux : public PrintingContext { |
| 23 public: | 23 public: |
| 24 explicit PrintingContextLinux(Delegate* delegate); | 24 explicit PrintingContextLinux(Delegate* delegate); |
| 25 virtual ~PrintingContextLinux(); | 25 ~PrintingContextLinux() override; |
| 26 | 26 |
| 27 // Sets the function that creates the print dialog. | 27 // Sets the function that creates the print dialog. |
| 28 static void SetCreatePrintDialogFunction( | 28 static void SetCreatePrintDialogFunction( |
| 29 PrintDialogGtkInterface* (*create_dialog_func)( | 29 PrintDialogGtkInterface* (*create_dialog_func)( |
| 30 PrintingContextLinux* context)); | 30 PrintingContextLinux* context)); |
| 31 | 31 |
| 32 // Sets the function that returns pdf paper size through the native API. | 32 // Sets the function that returns pdf paper size through the native API. |
| 33 static void SetPdfPaperSizeFunction( | 33 static void SetPdfPaperSizeFunction( |
| 34 gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context)); | 34 gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context)); |
| 35 | 35 |
| 36 // Prints the document contained in |metafile|. | 36 // Prints the document contained in |metafile|. |
| 37 void PrintDocument(const MetafilePlayer& metafile); | 37 void PrintDocument(const MetafilePlayer& metafile); |
| 38 | 38 |
| 39 // PrintingContext implementation. | 39 // PrintingContext implementation. |
| 40 virtual void AskUserForSettings( | 40 void AskUserForSettings(int max_pages, |
| 41 int max_pages, | 41 bool has_selection, |
| 42 bool has_selection, | 42 bool is_scripted, |
| 43 bool is_scripted, | 43 const PrintSettingsCallback& callback) override; |
| 44 const PrintSettingsCallback& callback) override; | 44 gfx::Size GetPdfPaperSizeDeviceUnits() override; |
| 45 virtual gfx::Size GetPdfPaperSizeDeviceUnits() override; | 45 Result UseDefaultSettings() override; |
| 46 virtual Result UseDefaultSettings() override; | 46 Result UpdatePrinterSettings(bool external_preview, |
| 47 virtual Result UpdatePrinterSettings(bool external_preview, | 47 bool show_system_dialog) override; |
| 48 bool show_system_dialog) override; | 48 Result InitWithSettings(const PrintSettings& settings) override; |
| 49 virtual Result InitWithSettings(const PrintSettings& settings) override; | 49 Result NewDocument(const base::string16& document_name) override; |
| 50 virtual Result NewDocument(const base::string16& document_name) override; | 50 Result NewPage() override; |
| 51 virtual Result NewPage() override; | 51 Result PageDone() override; |
| 52 virtual Result PageDone() override; | 52 Result DocumentDone() override; |
| 53 virtual Result DocumentDone() override; | 53 void Cancel() override; |
| 54 virtual void Cancel() override; | 54 void ReleaseContext() override; |
| 55 virtual void ReleaseContext() override; | 55 gfx::NativeDrawingContext context() const override; |
| 56 virtual gfx::NativeDrawingContext context() const override; | |
| 57 | 56 |
| 58 private: | 57 private: |
| 59 base::string16 document_name_; | 58 base::string16 document_name_; |
| 60 PrintDialogGtkInterface* print_dialog_; | 59 PrintDialogGtkInterface* print_dialog_; |
| 61 | 60 |
| 62 DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux); | 61 DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux); |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 } // namespace printing | 64 } // namespace printing |
| 66 | 65 |
| 67 #endif // PRINTING_PRINTING_CONTEXT_LINUX_H_ | 66 #endif // PRINTING_PRINTING_CONTEXT_LINUX_H_ |
| OLD | NEW |