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