1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PRINTING_PRINT_DIALOG_LINUX_INTERFACE_H_
6 #define PRINTING_PRINT_DIALOG_LINUX_INTERFACE_H_
11 #include "printing/printing_context_linux.h"
12 #include "ui/gfx/native_widget_types.h"
19 // An interface for Linux 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 PrintDialogLinuxInterface {
24 // Tell the dialog to use the default print setting.
25 virtual void UseDefaultSettings() = 0;
27 // Updates the dialog to use `settings`. Only used when printing without the
28 // system print dialog. E.g. for Print Preview.
29 virtual void UpdateSettings(std::unique_ptr<PrintSettings> settings) = 0;
31 #if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
32 // Updates the dialog to use system print dialog settings saved in `settings`.
33 virtual void LoadPrintSettings(const PrintSettings& settings) = 0;
36 // Shows the dialog and handles the response with `callback`. Only used when
37 // printing with the native print dialog.
38 virtual void ShowDialog(
39 gfx::NativeView parent_view,
41 PrintingContextLinux::PrintSettingsCallback callback) = 0;
43 // Prints the document named `document_name` contained in `metafile`.
44 // Called from the print worker thread. Once called, the
45 // PrintDialogLinuxInterface instance should not be reused.
46 virtual void PrintDocument(const MetafilePlayer& metafile,
47 const std::u16string& document_name) = 0;
49 // Releases the caller's ownership of the PrintDialogLinuxInterface. When
50 // called, the caller must not access the PrintDialogLinuxInterface
51 // afterwards, and vice versa.
52 virtual void ReleaseDialog() = 0;
55 virtual ~PrintDialogLinuxInterface() = default;
58 } // namespace printing
60 #endif // PRINTING_PRINT_DIALOG_LINUX_INTERFACE_H_