OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PRINTING_PRINT_DIALOG_GTK_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <gtk/gtkprintunixdialog.h> | 10 #include <gtk/gtkprintunixdialog.h> |
(...skipping 22 matching lines...) Expand all Loading... |
33 public base::RefCountedThreadSafe<PrintDialogGtk, | 33 public base::RefCountedThreadSafe<PrintDialogGtk, |
34 BrowserThread::DeleteOnUIThread> { | 34 BrowserThread::DeleteOnUIThread> { |
35 public: | 35 public: |
36 // Creates and returns a print dialog. | 36 // Creates and returns a print dialog. |
37 static printing::PrintDialogGtkInterface* CreatePrintDialog( | 37 static printing::PrintDialogGtkInterface* CreatePrintDialog( |
38 PrintingContextCairo* context); | 38 PrintingContextCairo* context); |
39 | 39 |
40 // printing::PrintDialogGtkInterface implementation. | 40 // printing::PrintDialogGtkInterface implementation. |
41 virtual void UseDefaultSettings(); | 41 virtual void UseDefaultSettings(); |
42 virtual bool UpdateSettings(const base::DictionaryValue& settings, | 42 virtual bool UpdateSettings(const base::DictionaryValue& settings, |
43 const printing::PageRanges& ranges); | 43 const printing::PageRanges& ranges, |
| 44 const base::DictionaryValue& header_footer_info); |
44 virtual void ShowDialog( | 45 virtual void ShowDialog( |
45 PrintingContextCairo::PrintSettingsCallback* callback); | 46 PrintingContextCairo::PrintSettingsCallback* callback); |
46 virtual void PrintDocument(const printing::Metafile* metafile, | 47 virtual void PrintDocument(const printing::Metafile* metafile, |
47 const string16& document_name); | 48 const string16& document_name); |
48 virtual void AddRefToDialog(); | 49 virtual void AddRefToDialog(); |
49 virtual void ReleaseDialog(); | 50 virtual void ReleaseDialog(); |
50 | 51 |
51 private: | 52 private: |
52 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 53 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
53 friend class DeleteTask<PrintDialogGtk>; | 54 friend class DeleteTask<PrintDialogGtk>; |
(...skipping 11 matching lines...) Expand all Loading... |
65 // Prints document named |document_name|. | 66 // Prints document named |document_name|. |
66 void SendDocumentToPrinter(const string16& document_name); | 67 void SendDocumentToPrinter(const string16& document_name); |
67 | 68 |
68 // Handles print job response. | 69 // Handles print job response. |
69 static void OnJobCompletedThunk(GtkPrintJob* print_job, | 70 static void OnJobCompletedThunk(GtkPrintJob* print_job, |
70 gpointer user_data, | 71 gpointer user_data, |
71 GError* error); | 72 GError* error); |
72 void OnJobCompleted(GtkPrintJob* print_job, GError* error); | 73 void OnJobCompleted(GtkPrintJob* print_job, GError* error); |
73 | 74 |
74 // Helper function for initializing |context_|'s PrintSettings with a given | 75 // Helper function for initializing |context_|'s PrintSettings with a given |
75 // set of |page_ranges|. | 76 // set of |page_ranges|. Also initializes the header footer strings present |
76 void InitPrintSettings(const printing::PageRanges& page_ranges); | 77 // in |header_footer_info| based on the page layout. |
| 78 void InitPrintSettings(const printing::PageRanges& page_ranges, |
| 79 const base::DictionaryValue& header_footer_info); |
77 | 80 |
78 // Printing dialog callback. | 81 // Printing dialog callback. |
79 PrintingContextCairo::PrintSettingsCallback* callback_; | 82 PrintingContextCairo::PrintSettingsCallback* callback_; |
80 PrintingContextCairo* context_; | 83 PrintingContextCairo* context_; |
81 | 84 |
82 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references | 85 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references |
83 // to the other objects. | 86 // to the other objects. |
84 GtkWidget* dialog_; | 87 GtkWidget* dialog_; |
85 GtkPrintSettings* gtk_settings_; | 88 GtkPrintSettings* gtk_settings_; |
86 GtkPageSetup* page_setup_; | 89 GtkPageSetup* page_setup_; |
87 GtkPrinter* printer_; | 90 GtkPrinter* printer_; |
88 | 91 |
89 // Event to signal when save document finishes. | 92 // Event to signal when save document finishes. |
90 scoped_ptr<base::WaitableEvent> save_document_event_; | 93 scoped_ptr<base::WaitableEvent> save_document_event_; |
91 | 94 |
92 FilePath path_to_pdf_; | 95 FilePath path_to_pdf_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); | 97 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); |
95 }; | 98 }; |
96 | 99 |
97 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ | 100 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ |
OLD | NEW |