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