OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | 5 #ifndef PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
6 #define PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | 6 #define PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
7 | 7 |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "printing/printing_context_gtk.h" | 9 #include "printing/printing_context_gtk.h" |
| 10 #include "ui/gfx/native_widget_types.h" |
10 | 11 |
11 namespace printing { | 12 namespace printing { |
12 | 13 |
13 class Metafile; | 14 class Metafile; |
14 class PrintSettings; | 15 class PrintSettings; |
15 | 16 |
16 // An interface for GTK printing dialogs. Classes that live outside of | 17 // An interface for GTK printing dialogs. Classes that live outside of |
17 // printing/ can implement this interface and get threading requirements | 18 // printing/ can implement this interface and get threading requirements |
18 // correct without exposing those requirements to printing/. | 19 // correct without exposing those requirements to printing/. |
19 class PrintDialogGtkInterface { | 20 class PrintDialogGtkInterface { |
20 public: | 21 public: |
21 // Tell the dialog to use the default print setting. | 22 // Tell the dialog to use the default print setting. |
22 virtual void UseDefaultSettings() = 0; | 23 virtual void UseDefaultSettings() = 0; |
23 | 24 |
24 // Update the dialog to use |job_settings| and |ranges|, where |job_settings| | 25 // Update the dialog to use |job_settings| and |ranges|, where |job_settings| |
25 // is a dictionary of settings with possible keys from | 26 // is a dictionary of settings with possible keys from |
26 // printing/print_job_constants.h. Only used when printing without the system | 27 // printing/print_job_constants.h. Only used when printing without the system |
27 // print dialog. E.g. for Print Preview. Returns false on error. | 28 // print dialog. E.g. for Print Preview. Returns false on error. |
28 virtual bool UpdateSettings(const base::DictionaryValue& job_settings, | 29 virtual bool UpdateSettings(const base::DictionaryValue& job_settings, |
29 const PageRanges& ranges, | 30 const PageRanges& ranges, |
30 PrintSettings* settings) = 0; | 31 PrintSettings* settings) = 0; |
31 | 32 |
32 // Shows the dialog and handles the response with |callback|. Only used when | 33 // Shows the dialog and handles the response with |callback|. Only used when |
33 // printing with the native print dialog. | 34 // printing with the native print dialog. |
34 virtual void ShowDialog( | 35 virtual void ShowDialog( |
| 36 gfx::NativeView parent_view, |
35 bool has_selection, | 37 bool has_selection, |
36 const PrintingContextGtk::PrintSettingsCallback& callback) = 0; | 38 const PrintingContextGtk::PrintSettingsCallback& callback) = 0; |
37 | 39 |
38 // Prints the document named |document_name| contained in |metafile|. | 40 // Prints the document named |document_name| contained in |metafile|. |
39 // Called from the print worker thread. Once called, the | 41 // Called from the print worker thread. Once called, the |
40 // PrintDialogGtkInterface instance should not be reused. | 42 // PrintDialogGtkInterface instance should not be reused. |
41 virtual void PrintDocument(const Metafile* metafile, | 43 virtual void PrintDocument(const Metafile* metafile, |
42 const string16& document_name) = 0; | 44 const string16& document_name) = 0; |
43 | 45 |
44 // Same as AddRef/Release, but with different names since | 46 // Same as AddRef/Release, but with different names since |
45 // PrintDialogGtkInterface does not inherit from RefCounted. | 47 // PrintDialogGtkInterface does not inherit from RefCounted. |
46 virtual void AddRefToDialog() = 0; | 48 virtual void AddRefToDialog() = 0; |
47 virtual void ReleaseDialog() = 0; | 49 virtual void ReleaseDialog() = 0; |
48 | 50 |
49 protected: | 51 protected: |
50 virtual ~PrintDialogGtkInterface() {} | 52 virtual ~PrintDialogGtkInterface() {} |
51 }; | 53 }; |
52 | 54 |
53 } // namespace printing | 55 } // namespace printing |
54 | 56 |
55 #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | 57 #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
OLD | NEW |