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 // Shows the dialog and handles the response with `callback`. Only used when
32 // printing with the native print dialog.
33 virtual void ShowDialog(
34 gfx::NativeView parent_view,
36 PrintingContextLinux::PrintSettingsCallback callback) = 0;
38 // Prints the document named `document_name` contained in `metafile`.
39 // Called from the print worker thread. Once called, the
40 // PrintDialogLinuxInterface instance should not be reused.
41 virtual void PrintDocument(const MetafilePlayer& metafile,
42 const std::u16string& document_name) = 0;
44 // Releases the caller's ownership of the PrintDialogLinuxInterface. When
45 // called, the caller must not access the PrintDialogLinuxInterface
46 // afterwards, and vice versa.
47 virtual void ReleaseDialog() = 0;
50 virtual ~PrintDialogLinuxInterface() = default;
53 } // namespace printing
55 #endif // PRINTING_PRINT_DIALOG_LINUX_INTERFACE_H_