| 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 #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 #include <printing/native_metafile.h> | 12 #include <printing/native_metafile.h> |
| 13 #include "printing/pdf_ps_metafile_cairo.h" |
| 13 #else | 14 #else |
| 14 #include <gtk/gtk.h> | 15 #include <gtk/gtk.h> |
| 15 #include <gtk/gtkprintunixdialog.h> | 16 #include <gtk/gtkprintunixdialog.h> |
| 16 | 17 |
| 17 #include "printing/print_settings_initializer_gtk.h" | 18 #include "printing/print_settings_initializer_gtk.h" |
| 18 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
| 19 | 20 |
| 20 #if !defined(OS_CHROMEOS) | 21 #if !defined(OS_CHROMEOS) |
| 21 namespace { | 22 namespace { |
| 22 // Function pointer for creating print dialogs. | 23 // Function pointer for creating print dialogs. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 height = static_cast<int>(11 * dpi); | 113 height = static_cast<int>(11 * dpi); |
| 113 } else { | 114 } else { |
| 114 // ulocdata_getPaperSize returns the width and height in mm. | 115 // ulocdata_getPaperSize returns the width and height in mm. |
| 115 // Convert this to pixels based on the dpi. | 116 // Convert this to pixels based on the dpi. |
| 116 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); | 117 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); |
| 117 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); | 118 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); |
| 118 } | 119 } |
| 119 | 120 |
| 120 physical_size_device_units.SetSize(width, height); | 121 physical_size_device_units.SetSize(width, height); |
| 121 printable_area_device_units.SetRect( | 122 printable_area_device_units.SetRect( |
| 122 static_cast<int>(NativeMetafile::kLeftMarginInInch * dpi), | 123 static_cast<int>(PdfPsMetafile::kLeftMarginInInch * dpi), |
| 123 static_cast<int>(NativeMetafile::kTopMarginInInch * dpi), | 124 static_cast<int>(PdfPsMetafile::kTopMarginInInch * dpi), |
| 124 width - (NativeMetafile::kLeftMarginInInch + | 125 width - (PdfPsMetafile::kLeftMarginInInch + |
| 125 NativeMetafile::kRightMarginInInch) * dpi, | 126 PdfPsMetafile::kRightMarginInInch) * dpi, |
| 126 height - (NativeMetafile::kTopMarginInInch + | 127 height - (PdfPsMetafile::kTopMarginInInch + |
| 127 NativeMetafile::kBottomMarginInInch) * dpi); | 128 PdfPsMetafile::kBottomMarginInInch) * dpi); |
| 128 | 129 |
| 129 settings_.set_dpi(dpi); | 130 settings_.set_dpi(dpi); |
| 130 settings_.SetPrinterPrintableArea(physical_size_device_units, | 131 settings_.SetPrinterPrintableArea(physical_size_device_units, |
| 131 printable_area_device_units, | 132 printable_area_device_units, |
| 132 dpi); | 133 dpi); |
| 133 #else // defined(OS_CHROMEOS) | 134 #else // defined(OS_CHROMEOS) |
| 134 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); | 135 GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); |
| 135 GtkPrintSettings* settings = | 136 GtkPrintSettings* settings = |
| 136 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); | 137 gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); |
| 137 GtkPageSetup* page_setup = | 138 GtkPageSetup* page_setup = |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void PrintingContextCairo::ReleaseContext() { | 208 void PrintingContextCairo::ReleaseContext() { |
| 208 // Intentional No-op. | 209 // Intentional No-op. |
| 209 } | 210 } |
| 210 | 211 |
| 211 gfx::NativeDrawingContext PrintingContextCairo::context() const { | 212 gfx::NativeDrawingContext PrintingContextCairo::context() const { |
| 212 // Intentional No-op. | 213 // Intentional No-op. |
| 213 return NULL; | 214 return NULL; |
| 214 } | 215 } |
| 215 | 216 |
| 216 } // namespace printing | 217 } // namespace printing |
| OLD | NEW |