[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 | |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 40 | // PrintingContext implementation. |
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 41 | void AskUserForSettings(int max_pages, |
42 | bool has_selection, | ||||
43 | bool is_scripted, | ||||
44 | const PrintSettingsCallback& callback) override; | ||||
45 | gfx::Size GetPdfPaperSizeDeviceUnits() override; | ||||
46 | Result UseDefaultSettings() override; | ||||
47 | Result UpdatePrinterSettings(bool external_preview, | ||||
vitalybuka | 95fa3c9 | 2015-05-05 03:03:32 | [diff] [blame] | 48 | bool show_system_dialog, |
49 | int page_count) override; | ||||
dcheng | 0f9f1d7 | 2014-12-22 23:35:16 | [diff] [blame] | 50 | Result InitWithSettings(const PrintSettings& settings) override; |
51 | Result NewDocument(const base::string16& document_name) override; | ||||
52 | Result NewPage() override; | ||||
53 | Result PageDone() override; | ||||
54 | Result DocumentDone() override; | ||||
55 | void Cancel() override; | ||||
56 | void ReleaseContext() override; | ||||
57 | gfx::NativeDrawingContext context() const override; | ||||
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 58 | |
59 | private: | ||||
[email protected] | b5fa4ee | 2013-10-01 07:19:07 | [diff] [blame] | 60 | base::string16 document_name_; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 61 | PrintDialogGtkInterface* print_dialog_; |
[email protected] | 5cc4c42 | 2011-02-19 00:09:22 | [diff] [blame] | 62 | |
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 63 | DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux); |
[email protected] | 51e8d935 | 2010-10-06 22:21:17 | [diff] [blame] | 64 | }; |
65 | |||||
66 | } // namespace printing | ||||
67 | |||||
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 68 | #endif // PRINTING_PRINTING_CONTEXT_LINUX_H_ |