[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 5 | #ifndef PRINTING_PRINTING_CONTEXT_LINUX_H_ |
6 | #define PRINTING_PRINTING_CONTEXT_LINUX_H_ | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 7 | |
[email protected] | ee5f36e4 | 2010-12-03 22:40:37 | [diff] [blame] | 8 | #include <string> |
9 | |||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 10 | #include "printing/printing_context.h" |
11 | |||||
[email protected] | f3a1c64 | 2011-07-12 19:15:03 | [diff] [blame] | 12 | namespace base { |
13 | class DictionaryValue; | ||||
14 | } | ||||
15 | |||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 16 | namespace printing { |
17 | |||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 18 | class Metafile; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 19 | class PrintDialogGtkInterface; |
20 | |||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 21 | // PrintingContext with optional native UI for print dialog and pdf_paper_size. |
22 | class PRINTING_EXPORT PrintingContextLinux : public PrintingContext { | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 23 | public: |
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 24 | explicit PrintingContextLinux(const std::string& app_locale); |
25 | virtual ~PrintingContextLinux(); | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 26 | |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 27 | // Sets the function that creates the print dialog. |
28 | static void SetCreatePrintDialogFunction( | ||||
29 | PrintDialogGtkInterface* (*create_dialog_func)( | ||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 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)); | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 35 | |
36 | // Prints the document contained in |metafile|. | ||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 37 | void PrintDocument(const Metafile* metafile); |
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 38 | |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 39 | // PrintingContext implementation. |
[email protected] | abe4811 | 2011-11-19 01:58:38 | [diff] [blame] | 40 | virtual void AskUserForSettings( |
41 | gfx::NativeView parent_view, | ||||
42 | int max_pages, | ||||
43 | bool has_selection, | ||||
44 | const PrintSettingsCallback& callback) OVERRIDE; | ||||
[email protected] | 4c9054b | 2013-11-04 18:34:29 | [diff] [blame] | 45 | virtual gfx::Size GetPdfPaperSizeDeviceUnits() OVERRIDE; |
[email protected] | d85a45c | 2011-11-16 17:28:53 | [diff] [blame] | 46 | virtual Result UseDefaultSettings() OVERRIDE; |
[email protected] | 4c9054b | 2013-11-04 18:34:29 | [diff] [blame] | 47 | virtual Result UpdatePrinterSettings(bool external_preview) OVERRIDE; |
[email protected] | d85a45c | 2011-11-16 17:28:53 | [diff] [blame] | 48 | virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE; |
[email protected] | b5fa4ee | 2013-10-01 07:19:07 | [diff] [blame] | 49 | virtual Result NewDocument(const base::string16& document_name) OVERRIDE; |
[email protected] | d85a45c | 2011-11-16 17:28:53 | [diff] [blame] | 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; | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 56 | |
57 | private: | ||||
[email protected] | b5fa4ee | 2013-10-01 07:19:07 | [diff] [blame] | 58 | base::string16 document_name_; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 59 | PrintDialogGtkInterface* print_dialog_; |
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 60 | |
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 61 | DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux); |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 62 | }; |
63 | |||||
64 | } // namespace printing | ||||
65 | |||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame^] | 66 | #endif // PRINTING_PRINTING_CONTEXT_LINUX_H_ |