[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 | |||||
[email protected] | 896d161f | 2013-06-11 22:52:24 | [diff] [blame^] | 8 | #include "base/strings/string16.h" |
[email protected] | ea5e81d9 | 2011-11-08 18:45:15 | [diff] [blame] | 9 | #include "printing/printing_context_gtk.h" |
[email protected] | e368b67 | 2012-05-24 02:30:52 | [diff] [blame] | 10 | #include "ui/gfx/native_widget_types.h" |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 11 | |
12 | namespace printing { | ||||
13 | |||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 14 | class Metafile; |
[email protected] | 1c23b4e8 | 2011-10-15 22:30:48 | [diff] [blame] | 15 | class PrintSettings; |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 16 | |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 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: | ||||
[email protected] | 2ed86fdf | 2011-04-19 20:57:03 | [diff] [blame] | 22 | // Tell the dialog to use the default print setting. |
23 | virtual void UseDefaultSettings() = 0; | ||||
24 | |||||
[email protected] | 1c23b4e8 | 2011-10-15 22:30:48 | [diff] [blame] | 25 | // Update the dialog to use |job_settings| and |ranges|, where |job_settings| |
26 | // is a dictionary of settings with possible keys from | ||||
[email protected] | 2ed86fdf | 2011-04-19 20:57:03 | [diff] [blame] | 27 | // printing/print_job_constants.h. Only used when printing without the system |
28 | // print dialog. E.g. for Print Preview. Returns false on error. | ||||
[email protected] | 1c23b4e8 | 2011-10-15 22:30:48 | [diff] [blame] | 29 | virtual bool UpdateSettings(const base::DictionaryValue& job_settings, |
30 | const PageRanges& ranges, | ||||
31 | PrintSettings* settings) = 0; | ||||
[email protected] | 2ed86fdf | 2011-04-19 20:57:03 | [diff] [blame] | 32 | |
33 | // Shows the dialog and handles the response with |callback|. Only used when | ||||
34 | // printing with the native print dialog. | ||||
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 35 | virtual void ShowDialog( |
[email protected] | e368b67 | 2012-05-24 02:30:52 | [diff] [blame] | 36 | gfx::NativeView parent_view, |
[email protected] | 437f9d8 | 2012-02-14 03:58:06 | [diff] [blame] | 37 | bool has_selection, |
[email protected] | abe4811 | 2011-11-19 01:58:38 | [diff] [blame] | 38 | const PrintingContextGtk::PrintSettingsCallback& callback) = 0; |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 39 | |
40 | // Prints the document named |document_name| contained in |metafile|. | ||||
41 | // Called from the print worker thread. Once called, the | ||||
42 | // PrintDialogGtkInterface instance should not be reused. | ||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 43 | virtual void PrintDocument(const Metafile* metafile, |
[email protected] | eaa389e | 2011-04-11 04:58:20 | [diff] [blame] | 44 | const string16& document_name) = 0; |
45 | |||||
46 | // Same as AddRef/Release, but with different names since | ||||
47 | // PrintDialogGtkInterface does not inherit from RefCounted. | ||||
48 | virtual void AddRefToDialog() = 0; | ||||
49 | virtual void ReleaseDialog() = 0; | ||||
50 | |||||
51 | protected: | ||||
52 | virtual ~PrintDialogGtkInterface() {} | ||||
53 | }; | ||||
54 | |||||
55 | } // namespace printing | ||||
56 | |||||
57 | #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |