OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ |
6 #define CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ | 6 #define CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <gtk/gtkunixprint.h> | 9 #include <gtk/gtkunixprint.h> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" | 15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "printing/print_dialog_gtk_interface.h" | 17 #include "printing/print_dialog_gtk_interface.h" |
18 #include "printing/printing_context_linux.h" | 18 #include "printing/printing_context_linux.h" |
19 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
20 | 20 |
21 namespace printing { | 21 namespace printing { |
22 class Metafile; | 22 class MetafilePlayer; |
23 class PrintSettings; | 23 class PrintSettings; |
24 } | 24 } |
25 | 25 |
26 using printing::PrintingContextLinux; | 26 using printing::PrintingContextLinux; |
27 | 27 |
28 // Needs to be freed on the UI thread to clean up its GTK members variables. | 28 // Needs to be freed on the UI thread to clean up its GTK members variables. |
29 class PrintDialogGtk2 | 29 class PrintDialogGtk2 |
30 : public printing::PrintDialogGtkInterface, | 30 : public printing::PrintDialogGtkInterface, |
31 public base::RefCountedThreadSafe< | 31 public base::RefCountedThreadSafe< |
32 PrintDialogGtk2, content::BrowserThread::DeleteOnUIThread>, | 32 PrintDialogGtk2, content::BrowserThread::DeleteOnUIThread>, |
33 public aura::WindowObserver { | 33 public aura::WindowObserver { |
34 public: | 34 public: |
35 // Creates and returns a print dialog. | 35 // Creates and returns a print dialog. |
36 static printing::PrintDialogGtkInterface* CreatePrintDialog( | 36 static printing::PrintDialogGtkInterface* CreatePrintDialog( |
37 PrintingContextLinux* context); | 37 PrintingContextLinux* context); |
38 | 38 |
39 // printing::PrintDialogGtkInterface implementation. | 39 // printing::PrintDialogGtkInterface implementation. |
40 virtual void UseDefaultSettings() OVERRIDE; | 40 virtual void UseDefaultSettings() OVERRIDE; |
41 virtual bool UpdateSettings(printing::PrintSettings* settings) OVERRIDE; | 41 virtual bool UpdateSettings(printing::PrintSettings* settings) OVERRIDE; |
42 virtual void ShowDialog( | 42 virtual void ShowDialog( |
43 gfx::NativeView parent_view, | 43 gfx::NativeView parent_view, |
44 bool has_selection, | 44 bool has_selection, |
45 const PrintingContextLinux::PrintSettingsCallback& callback) OVERRIDE; | 45 const PrintingContextLinux::PrintSettingsCallback& callback) OVERRIDE; |
46 virtual void PrintDocument(const printing::Metafile* metafile, | 46 virtual void PrintDocument(const printing::MetafilePlayer& metafile, |
47 const base::string16& document_name) OVERRIDE; | 47 const base::string16& document_name) OVERRIDE; |
48 virtual void AddRefToDialog() OVERRIDE; | 48 virtual void AddRefToDialog() OVERRIDE; |
49 virtual void ReleaseDialog() OVERRIDE; | 49 virtual void ReleaseDialog() OVERRIDE; |
50 | 50 |
51 private: | 51 private: |
52 friend struct content::BrowserThread::DeleteOnThread< | 52 friend struct content::BrowserThread::DeleteOnThread< |
53 content::BrowserThread::UI>; | 53 content::BrowserThread::UI>; |
54 friend class base::DeleteHelper<PrintDialogGtk2>; | 54 friend class base::DeleteHelper<PrintDialogGtk2>; |
55 | 55 |
56 explicit PrintDialogGtk2(PrintingContextLinux* context); | 56 explicit PrintDialogGtk2(PrintingContextLinux* context); |
(...skipping 28 matching lines...) Expand all Loading... |
85 GtkPrintSettings* gtk_settings_; | 85 GtkPrintSettings* gtk_settings_; |
86 GtkPageSetup* page_setup_; | 86 GtkPageSetup* page_setup_; |
87 GtkPrinter* printer_; | 87 GtkPrinter* printer_; |
88 | 88 |
89 base::FilePath path_to_pdf_; | 89 base::FilePath path_to_pdf_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk2); | 91 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk2); |
92 }; | 92 }; |
93 | 93 |
94 #endif // CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ | 94 #endif // CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ |
OLD | NEW |