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

Side by Side Diff: printing/printing_context_cairo.cc

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