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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 bool UpdateSettings(printing::PrintSettings* settings) override; | 41 bool UpdateSettings(printing::PrintSettings* settings) override; |
42 void ShowDialog( | 42 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 void PrintDocument(const printing::MetafilePlayer& metafile, | 46 void PrintDocument(const printing::MetafilePlayer& metafile, |
47 const base::string16& document_name) override; | 47 const base::string16& document_name) override; |
48 void AddRefToDialog() override; | 48 void AddRefToDialog() override; |
49 void ReleaseDialog() override; | 49 void ReleaseDialog() override; |
50 | 50 |
| 51 // Handles print job response. |
| 52 void OnJobCompleted(GtkPrintJob* print_job, const GError* error); |
| 53 |
51 private: | 54 private: |
52 friend struct content::BrowserThread::DeleteOnThread< | 55 friend struct content::BrowserThread::DeleteOnThread< |
53 content::BrowserThread::UI>; | 56 content::BrowserThread::UI>; |
54 friend class base::DeleteHelper<PrintDialogGtk2>; | 57 friend class base::DeleteHelper<PrintDialogGtk2>; |
55 | 58 |
56 explicit PrintDialogGtk2(PrintingContextLinux* context); | 59 explicit PrintDialogGtk2(PrintingContextLinux* context); |
57 ~PrintDialogGtk2() override; | 60 ~PrintDialogGtk2() override; |
58 | 61 |
59 // Handles dialog response. | 62 // Handles dialog response. |
60 CHROMEGTK_CALLBACK_1(PrintDialogGtk2, void, OnResponse, int); | 63 CHROMEGTK_CALLBACK_1(PrintDialogGtk2, void, OnResponse, int); |
61 | 64 |
62 // Prints document named |document_name|. | 65 // Prints document named |document_name|. |
63 void SendDocumentToPrinter(const base::string16& document_name); | 66 void SendDocumentToPrinter(const base::string16& document_name); |
64 | 67 |
65 // Handles print job response. | |
66 static void OnJobCompletedThunk(GtkPrintJob* print_job, | |
67 gpointer user_data, | |
68 GError* error); | |
69 void OnJobCompleted(GtkPrintJob* print_job, GError* error); | |
70 | |
71 // Helper function for initializing |context_|'s PrintSettings with a given | 68 // Helper function for initializing |context_|'s PrintSettings with a given |
72 // |settings|. | 69 // |settings|. |
73 void InitPrintSettings(printing::PrintSettings* settings); | 70 void InitPrintSettings(printing::PrintSettings* settings); |
74 | 71 |
75 // aura::WindowObserver implementation. | 72 // aura::WindowObserver implementation. |
76 void OnWindowDestroying(aura::Window* window) override; | 73 void OnWindowDestroying(aura::Window* window) override; |
77 | 74 |
78 // Printing dialog callback. | 75 // Printing dialog callback. |
79 PrintingContextLinux::PrintSettingsCallback callback_; | 76 PrintingContextLinux::PrintSettingsCallback callback_; |
80 PrintingContextLinux* context_; | 77 PrintingContextLinux* context_; |
81 | 78 |
82 // Print dialog settings. PrintDialogGtk2 owns |dialog_| and holds references | 79 // Print dialog settings. PrintDialogGtk2 owns |dialog_| and holds references |
83 // to the other objects. | 80 // to the other objects. |
84 GtkWidget* dialog_; | 81 GtkWidget* dialog_; |
85 GtkPrintSettings* gtk_settings_; | 82 GtkPrintSettings* gtk_settings_; |
86 GtkPageSetup* page_setup_; | 83 GtkPageSetup* page_setup_; |
87 GtkPrinter* printer_; | 84 GtkPrinter* printer_; |
88 | 85 |
89 base::FilePath path_to_pdf_; | 86 base::FilePath path_to_pdf_; |
90 | 87 |
91 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk2); | 88 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk2); |
92 }; | 89 }; |
93 | 90 |
94 #endif // CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ | 91 #endif // CHROME_BROWSER_UI_LIBGTK2UI_PRINT_DIALOG_GTK2_H_ |
OLD | NEW |