Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 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 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 8 | #include "base/strings/string16.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 9 | #include "printing/printing_context_gtk.h" |
| 10 | #include "ui/gfx/native_widget_types.h" |
| 11 | |
| 12 | namespace printing { |
| 13 | |
| 14 | class Metafile; |
| 15 | class PrintSettings; |
| 16 | |
| 17 | // An interface for GTK printing dialogs. Classes that live outside of |
| 18 | // printing/ can implement this interface and get threading requirements |
| 19 | // correct without exposing those requirements to printing/. |
| 20 | class PrintDialogGtkInterface { |
| 21 | public: |
| 22 | // Tell the dialog to use the default print setting. |
| 23 | virtual void UseDefaultSettings() = 0; |
| 24 | |
Torne (Richard Coles) | 1e9bf3e | 2013-10-31 11:16:26 +0000 | [diff] [blame] | 25 | // Updates the dialog to use |settings|. Only used when printing without the |
| 26 | // system print dialog. E.g. for Print Preview. Returns false on error. |
Torne (Richard Coles) | 0f1bc08 | 2013-11-06 12:27:47 +0000 | [diff] [blame] | 27 | virtual bool UpdateSettings(PrintSettings* settings) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 28 | |
| 29 | // Shows the dialog and handles the response with |callback|. Only used when |
| 30 | // printing with the native print dialog. |
| 31 | virtual void ShowDialog( |
| 32 | gfx::NativeView parent_view, |
| 33 | bool has_selection, |
| 34 | const PrintingContextGtk::PrintSettingsCallback& callback) = 0; |
| 35 | |
| 36 | // Prints the document named |document_name| contained in |metafile|. |
| 37 | // Called from the print worker thread. Once called, the |
| 38 | // PrintDialogGtkInterface instance should not be reused. |
| 39 | virtual void PrintDocument(const Metafile* metafile, |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame] | 40 | const base::string16& document_name) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 41 | |
| 42 | // Same as AddRef/Release, but with different names since |
| 43 | // PrintDialogGtkInterface does not inherit from RefCounted. |
| 44 | virtual void AddRefToDialog() = 0; |
| 45 | virtual void ReleaseDialog() = 0; |
| 46 | |
| 47 | protected: |
| 48 | virtual ~PrintDialogGtkInterface() {} |
| 49 | }; |
| 50 | |
| 51 | } // namespace printing |
| 52 | |
| 53 | #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |