| 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 | 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |