[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 | |||||
avi | 126e93c | 2015-12-21 21:48:16 | [diff] [blame] | 10 | #include "base/macros.h" |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 11 | #include "printing/printing_context.h" |
12 | |||||
13 | namespace printing { | ||||
14 | |||||
vitalybuka | 5d129058 | 2014-09-12 09:19:59 | [diff] [blame] | 15 | class MetafilePlayer; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 16 | class PrintDialogGtkInterface; |
17 | |||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 18 | // PrintingContext with optional native UI for print dialog and pdf_paper_size. |
19 | class PRINTING_EXPORT PrintingContextLinux : public PrintingContext { | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 20 | public: |
Vitaly Buka | bd7c981 | 2014-08-26 08:57:54 | [diff] [blame] | 21 | explicit PrintingContextLinux(Delegate* delegate); |
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 22 | ~PrintingContextLinux() override; |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 23 | |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 24 | // Sets the function that creates the print dialog. |
25 | static void SetCreatePrintDialogFunction( | ||||
26 | PrintDialogGtkInterface* (*create_dialog_func)( | ||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 27 | PrintingContextLinux* context)); |
28 | |||||
29 | // Sets the function that returns pdf paper size through the native API. | ||||
30 | static void SetPdfPaperSizeFunction( | ||||
31 | gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context)); | ||||
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 32 | |
33 | // Prints the document contained in |metafile|. | ||||
vitalybuka | 5d129058 | 2014-09-12 09:19:59 | [diff] [blame] | 34 | void PrintDocument(const MetafilePlayer& metafile); |
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 35 | |
thestig | 5f68391 | 2016-09-30 22:42:16 | [diff] [blame] | 36 | // Initializes with predefined settings. |
37 | void InitWithSettings(const PrintSettings& settings); | ||||
38 | |||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 39 | // PrintingContext implementation. |
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 40 | void AskUserForSettings(int max_pages, |
41 | bool has_selection, | ||||
42 | bool is_scripted, | ||||
Vladislav Kuzkokov | 48ceab2 | 2018-02-14 16:29:28 | [diff] [blame] | 43 | PrintSettingsCallback callback) override; |
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 44 | gfx::Size GetPdfPaperSizeDeviceUnits() override; |
45 | Result UseDefaultSettings() override; | ||||
46 | Result UpdatePrinterSettings(bool external_preview, | ||||
vitalybuka | 95fa3c9 | 2015-05-05 03:03:32 | [diff] [blame] | 47 | bool show_system_dialog, |
48 | int page_count) override; | ||||
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 49 | Result NewDocument(const base::string16& document_name) override; |
50 | Result NewPage() override; | ||||
51 | Result PageDone() override; | ||||
52 | Result DocumentDone() override; | ||||
53 | void Cancel() override; | ||||
54 | void ReleaseContext() override; | ||||
Nico Weber | 8e55956 | 2017-10-03 01:25:26 | [diff] [blame] | 55 | printing::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_ |