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

Side by Side Diff: printing/printing_context_cairo.cc

Issue 6594121: Revert 76553 - Applying factory pattern (through NativeMetafileFactory class)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | « printing/printing.gyp ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.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 #include "printing/printing_context_cairo.h" 5 #include "printing/printing_context_cairo.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "printing/units.h" 8 #include "printing/units.h"
9 9
10 #if defined(OS_CHROMEOS) 10 #if defined(OS_CHROMEOS)
11 #include <unicode/ulocdata.h> 11 #include <unicode/ulocdata.h>
12 12 #include <printing/native_metafile.h>
13 #include "printing/native_metafile.h"
14 #include "printing/pdf_ps_metafile_cairo.h"
15 #else 13 #else
16 #include <gtk/gtk.h> 14 #include <gtk/gtk.h>
17 #include <gtk/gtkprintunixdialog.h> 15 #include <gtk/gtkprintunixdialog.h>
18 16
19 #include "printing/print_settings_initializer_gtk.h" 17 #include "printing/print_settings_initializer_gtk.h"
20 #endif // defined(OS_CHROMEOS) 18 #endif // defined(OS_CHROMEOS)
21 19
22 #if !defined(OS_CHROMEOS) 20 #if !defined(OS_CHROMEOS)
23 namespace { 21 namespace {
24 // Function pointer for creating print dialogs. 22 // Function pointer for creating print dialogs.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 height = static_cast<int>(11 * dpi); 112 height = static_cast<int>(11 * dpi);
115 } else { 113 } else {
116 // ulocdata_getPaperSize returns the width and height in mm. 114 // ulocdata_getPaperSize returns the width and height in mm.
117 // Convert this to pixels based on the dpi. 115 // Convert this to pixels based on the dpi.
118 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); 116 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi);
119 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); 117 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi);
120 } 118 }
121 119
122 physical_size_device_units.SetSize(width, height); 120 physical_size_device_units.SetSize(width, height);
123 printable_area_device_units.SetRect( 121 printable_area_device_units.SetRect(
124 static_cast<int>(PdfPsMetafile::kLeftMarginInInch * dpi), 122 static_cast<int>(NativeMetafile::kLeftMarginInInch * dpi),
125 static_cast<int>(PdfPsMetafile::kTopMarginInInch * dpi), 123 static_cast<int>(NativeMetafile::kTopMarginInInch * dpi),
126 width - (PdfPsMetafile::kLeftMarginInInch + 124 width - (NativeMetafile::kLeftMarginInInch +
127 PdfPsMetafile::kRightMarginInInch) * dpi, 125 NativeMetafile::kRightMarginInInch) * dpi,
128 height - (PdfPsMetafile::kTopMarginInInch + 126 height - (NativeMetafile::kTopMarginInInch +
129 PdfPsMetafile::kBottomMarginInInch) * dpi); 127 NativeMetafile::kBottomMarginInInch) * dpi);
130 128
131 settings_.set_dpi(dpi); 129 settings_.set_dpi(dpi);
132 settings_.SetPrinterPrintableArea(physical_size_device_units, 130 settings_.SetPrinterPrintableArea(physical_size_device_units,
133 printable_area_device_units, 131 printable_area_device_units,
134 dpi); 132 dpi);
135 #else // defined(OS_CHROMEOS) 133 #else // defined(OS_CHROMEOS)
136 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); 134 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL);
137 GtkPrintSettings* settings = 135 GtkPrintSettings* settings =
138 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); 136 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog));
139 GtkPageSetup* page_setup = 137 GtkPageSetup* page_setup =
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void PrintingContextCairo::ReleaseContext() { 207 void PrintingContextCairo::ReleaseContext() {
210 // Intentional No-op. 208 // Intentional No-op.
211 } 209 }
212 210
213 gfx::NativeDrawingContext PrintingContextCairo::context() const { 211 gfx::NativeDrawingContext PrintingContextCairo::context() const {
214 // Intentional No-op. 212 // Intentional No-op.
215 return NULL; 213 return NULL;
216 } 214 }
217 215
218 } // namespace printing 216 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing.gyp ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698