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

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

Issue 8201027: Move margin processing code to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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/compiler_specific.h"
12 #include "base/file_path.h" 13 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
16 #include "printing/print_dialog_gtk_interface.h" 17 #include "printing/print_dialog_gtk_interface.h"
17 #include "printing/printing_context_cairo.h" 18 #include "printing/printing_context_cairo.h"
18 #include "ui/base/gtk/gtk_signal.h" 19 #include "ui/base/gtk/gtk_signal.h"
19 20
20 namespace printing { 21 namespace printing {
21 class Metafile; 22 class Metafile;
23 class PrintSettings;
22 } 24 }
23 25
24 using printing::PrintingContextCairo; 26 using printing::PrintingContextCairo;
25 27
26 // 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.
27 class PrintDialogGtk 29 class PrintDialogGtk
28 : public printing::PrintDialogGtkInterface, 30 : public printing::PrintDialogGtkInterface,
29 public base::RefCountedThreadSafe<PrintDialogGtk, 31 public base::RefCountedThreadSafe<PrintDialogGtk,
30 BrowserThread::DeleteOnUIThread> { 32 BrowserThread::DeleteOnUIThread> {
31 public: 33 public:
32 // Creates and returns a print dialog. 34 // Creates and returns a print dialog.
33 static printing::PrintDialogGtkInterface* CreatePrintDialog( 35 static printing::PrintDialogGtkInterface* CreatePrintDialog(
34 PrintingContextCairo* context); 36 PrintingContextCairo* context);
35 37
36 // printing::PrintDialogGtkInterface implementation. 38 // printing::PrintDialogGtkInterface implementation.
37 virtual void UseDefaultSettings(); 39 virtual void UseDefaultSettings() OVERRIDE;
38 virtual bool UpdateSettings(const base::DictionaryValue& settings, 40 virtual bool UpdateSettings(const base::DictionaryValue& job_settings,
39 const printing::PageRanges& ranges); 41 const printing::PageRanges& ranges,
42 printing::PrintSettings* settings) OVERRIDE;
40 virtual void ShowDialog( 43 virtual void ShowDialog(
41 PrintingContextCairo::PrintSettingsCallback* callback); 44 PrintingContextCairo::PrintSettingsCallback* callback) OVERRIDE;
42 virtual void PrintDocument(const printing::Metafile* metafile, 45 virtual void PrintDocument(const printing::Metafile* metafile,
43 const string16& document_name); 46 const string16& document_name) OVERRIDE;
44 virtual void AddRefToDialog(); 47 virtual void AddRefToDialog() OVERRIDE;
45 virtual void ReleaseDialog(); 48 virtual void ReleaseDialog() OVERRIDE;
46 49
47 private: 50 private:
48 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 51 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
49 friend class DeleteTask<PrintDialogGtk>; 52 friend class DeleteTask<PrintDialogGtk>;
50 53
51 explicit PrintDialogGtk(PrintingContextCairo* context); 54 explicit PrintDialogGtk(PrintingContextCairo* context);
52 virtual ~PrintDialogGtk(); 55 virtual ~PrintDialogGtk();
53 56
54 // Handles dialog response. 57 // Handles dialog response.
55 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int); 58 CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int);
56 59
57 // Prints document named |document_name|. 60 // Prints document named |document_name|.
58 void SendDocumentToPrinter(const string16& document_name); 61 void SendDocumentToPrinter(const string16& document_name);
59 62
60 // Handles print job response. 63 // Handles print job response.
61 static void OnJobCompletedThunk(GtkPrintJob* print_job, 64 static void OnJobCompletedThunk(GtkPrintJob* print_job,
62 gpointer user_data, 65 gpointer user_data,
63 GError* error); 66 GError* error);
64 void OnJobCompleted(GtkPrintJob* print_job, GError* error); 67 void OnJobCompleted(GtkPrintJob* print_job, GError* error);
65 68
66 // Helper function for initializing |context_|'s PrintSettings with a given 69 // Helper function for initializing |context_|'s PrintSettings with a given
67 // set of |page_ranges|. 70 // set of |page_ranges|.
Lei Zhang 2011/10/08 02:02:05 nit: update comment?
vandebo (ex-Chrome) 2011/10/15 00:42:50 Done.
68 void InitPrintSettings(const printing::PageRanges& page_ranges); 71 void InitPrintSettings(const printing::PageRanges& page_ranges,
72 printing::PrintSettings* settings);
69 73
70 // Printing dialog callback. 74 // Printing dialog callback.
71 PrintingContextCairo::PrintSettingsCallback* callback_; 75 PrintingContextCairo::PrintSettingsCallback* callback_;
72 PrintingContextCairo* context_; 76 PrintingContextCairo* context_;
73 77
74 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references 78 // Print dialog settings. PrintDialogGtk owns |dialog_| and holds references
75 // to the other objects. 79 // to the other objects.
76 GtkWidget* dialog_; 80 GtkWidget* dialog_;
77 GtkPrintSettings* gtk_settings_; 81 GtkPrintSettings* gtk_settings_;
78 GtkPageSetup* page_setup_; 82 GtkPageSetup* page_setup_;
79 GtkPrinter* printer_; 83 GtkPrinter* printer_;
80 84
81 FilePath path_to_pdf_; 85 FilePath path_to_pdf_;
82 86
83 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); 87 DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk);
84 }; 88 };
85 89
86 #endif // CHROME_BROWSER_PRINTING_PRINT_DIALOG_GTK_H_ 90 #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/printing_message_filter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698