Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: chrome/browser/printing/print_dialog_gtk.h

Issue 7639014: Linux: Simplify printing code and make it more reliable during shutdown. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/printing/print_dialog_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
16 #include "printing/print_dialog_gtk_interface.h" 16 #include "printing/print_dialog_gtk_interface.h"
17 #include "printing/printing_context_cairo.h" 17 #include "printing/printing_context_cairo.h"
18 #include "ui/base/gtk/gtk_signal.h" 18 #include "ui/base/gtk/gtk_signal.h"
19 19
20 namespace base {
21 class WaitableEvent;
22 }
23
24 namespace printing { 20 namespace printing {
25 class Metafile; 21 class Metafile;
26 } 22 }
27 23
28 using printing::PrintingContextCairo; 24 using printing::PrintingContextCairo;
29 25
30 // Needs to be freed on the UI thread to clean up its GTK members variables. 26 // Needs to be freed on the UI thread to clean up its GTK members variables.
31 class PrintDialogGtk 27 class PrintDialogGtk
32 : public printing::PrintDialogGtkInterface, 28 : public printing::PrintDialogGtkInterface,
33 public base::RefCountedThreadSafe<PrintDialogGtk, 29 public base::RefCountedThreadSafe<PrintDialogGtk,
(...skipping 17 matching lines...) Expand all
51 private: 47 private:
52 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 48 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
53 friend class DeleteTask<PrintDialogGtk>; 49 friend class DeleteTask<PrintDialogGtk>;
54 50
55 explicit PrintDialogGtk(PrintingContextCairo* context); 51 explicit PrintDialogGtk(PrintingContextCairo* context);
56 virtual ~PrintDialogGtk(); 52 virtual ~PrintDialogGtk();
57 53
58 // Handles dialog response. 54 // Handles dialog response.
59 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int); 55 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int);
60 56
61 // Saves data in |metafile| to disk for document named |document_name|.
62 void SaveDocumentToDisk(const printing::Metafile* metafile,
63 const string16& document_name);
64
65 // Prints document named |document_name|. 57 // Prints document named |document_name|.
66 void SendDocumentToPrinter(const string16& document_name); 58 void SendDocumentToPrinter(const string16& document_name);
67 59
68 // Handles print job response. 60 // Handles print job response.
69 static void OnJobCompletedThunk(GtkPrintJob* print_job, 61 static void OnJobCompletedThunk(GtkPrintJob* print_job,
70 gpointer user_data, 62 gpointer user_data,
71 GError* error); 63 GError* error);
72 void OnJobCompleted(GtkPrintJob* print_job, GError* error); 64 void OnJobCompleted(GtkPrintJob* print_job, GError* error);
73 65
74 // Helper function for initializing |context_|'s PrintSettings with a given 66 // Helper function for initializing |context_|'s PrintSettings with a given
75 // set of |page_ranges|. 67 // set of |page_ranges|.
76 void InitPrintSettings(const printing::PageRanges& page_ranges); 68 void InitPrintSettings(const printing::PageRanges& page_ranges);
77 69
78 // Printing dialog callback. 70 // Printing dialog callback.
79 PrintingContextCairo::PrintSettingsCallback* callback_; 71 PrintingContextCairo::PrintSettingsCallback* callback_;
80 PrintingContextCairo* context_; 72 PrintingContextCairo* context_;
81 73
82 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references 74 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references
83 // to the other objects. 75 // to the other objects.
84 GtkWidget* dialog_; 76 GtkWidget* dialog_;
85 GtkPrintSettings* gtk_settings_; 77 GtkPrintSettings* gtk_settings_;
86 GtkPageSetup* page_setup_; 78 GtkPageSetup* page_setup_;
87 GtkPrinter* printer_; 79 GtkPrinter* printer_;
88 80
89 // Event to signal when save document finishes.
90 scoped_ptr<base::WaitableEvent> save_document_event_;
91
92 FilePath path_to_pdf_; 81 FilePath path_to_pdf_;
93 82
94 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); 83 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk);
95 }; 84 };
96 85
97 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ 86 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698