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

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

Issue 6826027: Connect the right metafiles for print preview on Linux and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile issues and rename MetafileInterface to Metafile Created 9 years, 8 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
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 "printing/native_metafile.h" 14 #include "printing/metafile.h"
15 #include "printing/printing_context_cairo.h" 15 #include "printing/printing_context_cairo.h"
16 #include "ui/base/gtk/gtk_signal.h" 16 #include "ui/base/gtk/gtk_signal.h"
17 17
18 namespace base { 18 namespace base {
19 class WaitableEvent; 19 class WaitableEvent;
20 } 20 }
21 21
22 using printing::NativeMetafile;
23 using printing::PrintingContextCairo; 22 using printing::PrintingContextCairo;
24 23
25 class PrintDialogGtk : public base::RefCountedThreadSafe<PrintDialogGtk> { 24 class PrintDialogGtk : public base::RefCountedThreadSafe<PrintDialogGtk> {
26 public: 25 public:
27 // Creates and returns a print dialog. The dialog will initialize the settings 26 // Creates and returns a print dialog. The dialog will initialize the settings
28 // for |context| and call |callback| to inform the print workflow of the 27 // for |context| and call |callback| to inform the print workflow of the
29 // dialog results. 28 // dialog results.
30 static void* CreatePrintDialog( 29 static void* CreatePrintDialog(
31 PrintingContextCairo::PrintSettingsCallback* callback, 30 PrintingContextCairo::PrintSettingsCallback* callback,
32 PrintingContextCairo* context); 31 PrintingContextCairo* context);
33 32
34 // Prints a document named |document_name| based on the settings in 33 // Prints a document named |document_name| based on the settings in
35 // |print_dialog|, with data from |metafile|. 34 // |print_dialog|, with data from |metafile|.
36 // Called from the print worker thread. 35 // Called from the print worker thread.
37 static void PrintDocument(void* print_dialog, 36 static void PrintDocument(void* print_dialog,
38 const NativeMetafile* metafile, 37 const printing::Metafile* metafile,
39 const string16& document_name); 38 const string16& document_name);
40 39
41 private: 40 private:
42 friend class base::RefCountedThreadSafe<PrintDialogGtk>; 41 friend class base::RefCountedThreadSafe<PrintDialogGtk>;
43 42
44 PrintDialogGtk(PrintingContextCairo::PrintSettingsCallback* callback, 43 PrintDialogGtk(PrintingContextCairo::PrintSettingsCallback* callback,
45 PrintingContextCairo* context); 44 PrintingContextCairo* context);
46 ~PrintDialogGtk(); 45 ~PrintDialogGtk();
47 46
48 // Handles dialog response. 47 // Handles dialog response.
49 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int); 48 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int);
50 49
51 // Saves data in |metafile| to disk for document named |document_name|. 50 // Saves data in |metafile| to disk for document named |document_name|.
52 void SaveDocumentToDisk(const NativeMetafile* metafile, 51 void SaveDocumentToDisk(const printing::Metafile* metafile,
53 const string16& document_name); 52 const string16& document_name);
54 53
55 // Prints document named |document_name|. 54 // Prints document named |document_name|.
56 void SendDocumentToPrinter(const string16& document_name); 55 void SendDocumentToPrinter(const string16& document_name);
57 56
58 // Handles print job response. 57 // Handles print job response.
59 static void OnJobCompletedThunk(GtkPrintJob* print_job, 58 static void OnJobCompletedThunk(GtkPrintJob* print_job,
60 gpointer user_data, 59 gpointer user_data,
61 GError* error); 60 GError* error);
62 void OnJobCompleted(GtkPrintJob* print_job, GError* error); 61 void OnJobCompleted(GtkPrintJob* print_job, GError* error);
(...skipping 11 matching lines...) Expand all
74 GtkPrintSettings* gtk_settings_; 73 GtkPrintSettings* gtk_settings_;
75 74
76 // Event to signal when save document finishes. 75 // Event to signal when save document finishes.
77 base::WaitableEvent* save_document_event_; 76 base::WaitableEvent* save_document_event_;
78 FilePath path_to_pdf_; 77 FilePath path_to_pdf_;
79 78
80 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); 79 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk);
81 }; 80 };
82 81
83 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ 82 #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') | chrome/browser/printing/print_view_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698