[email protected] | 437f9d8 | 2012-02-14 03:58:06 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [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 | |||||
5 | #ifndef PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | ||||
6 | #define PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | ||||
7 | |||||
Vladislav Kuzkokov | 1999822 | 2019-08-12 14:26:09 | [diff] [blame] | 8 | #include <memory> |
9 | |||||
[email protected] | 896d161f | 2013-06-11 22:52:24 | [diff] [blame] | 10 | #include "base/strings/string16.h" |
[email protected] | d53002f4 | 2014-01-14 16:08:56 | [diff] [blame] | 11 | #include "printing/printing_context_linux.h" |
[email protected] | e368b67 | 2012-05-24 02:30:52 | [diff] [blame] | 12 | #include "ui/gfx/native_widget_types.h" |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 13 | |
14 | namespace printing { | ||||
15 | |||||
vitalybuka | 5d129058 | 2014-09-12 09:19:59 | [diff] [blame] | 16 | class MetafilePlayer; |
[email protected] | 1c23b4e8 | 2011-10-15 22:30:48 | [diff] [blame] | 17 | class PrintSettings; |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 18 | |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 19 | // An interface for GTK printing dialogs. Classes that live outside of |
20 | // printing/ can implement this interface and get threading requirements | ||||
21 | // correct without exposing those requirements to printing/. | ||||
22 | class PrintDialogGtkInterface { | ||||
23 | public: | ||||
[email protected] | 2ed86fdf | 2011-04-19 20:57:03 | [diff] [blame] | 24 | // Tell the dialog to use the default print setting. |
25 | virtual void UseDefaultSettings() = 0; | ||||
26 | |||||
[email protected] | e5324b5 | 2013-10-29 03:16:37 | [diff] [blame] | 27 | // Updates the dialog to use |settings|. Only used when printing without the |
Lei Zhang | 5cea78b | 2018-05-04 17:37:16 | [diff] [blame] | 28 | // system print dialog. E.g. for Print Preview. |
Vladislav Kuzkokov | 1999822 | 2019-08-12 14:26:09 | [diff] [blame] | 29 | virtual void UpdateSettings(std::unique_ptr<PrintSettings> settings) = 0; |
[email protected] | 2ed86fdf | 2011-04-19 20:57:03 | [diff] [blame] | 30 | |
31 | // Shows the dialog and handles the response with |callback|. Only used when | ||||
32 | // printing with the native print dialog. | ||||
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 33 | virtual void ShowDialog( |
[email protected] | e368b67 | 2012-05-24 02:30:52 | [diff] [blame] | 34 | gfx::NativeView parent_view, |
[email protected] | 437f9d8 | 2012-02-14 03:58:06 | [diff] [blame] | 35 | bool has_selection, |
Vladislav Kuzkokov | 48ceab2 | 2018-02-14 16:29:28 | [diff] [blame] | 36 | PrintingContextLinux::PrintSettingsCallback callback) = 0; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 37 | |
38 | // Prints the document named |document_name| contained in |metafile|. | ||||
39 | // Called from the print worker thread. Once called, the | ||||
40 | // PrintDialogGtkInterface instance should not be reused. | ||||
vitalybuka | 5d129058 | 2014-09-12 09:19:59 | [diff] [blame] | 41 | virtual void PrintDocument(const MetafilePlayer& metafile, |
[email protected] | b5fa4ee | 2013-10-01 07:19:07 | [diff] [blame] | 42 | const base::string16& document_name) = 0; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 43 | |
44 | // Same as AddRef/Release, but with different names since | ||||
45 | // PrintDialogGtkInterface does not inherit from RefCounted. | ||||
46 | virtual void AddRefToDialog() = 0; | ||||
47 | virtual void ReleaseDialog() = 0; | ||||
48 | |||||
49 | protected: | ||||
50 | virtual ~PrintDialogGtkInterface() {} | ||||
51 | }; | ||||
52 | |||||
53 | } // namespace printing | ||||
54 | |||||
55 | #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |