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

Side by Side Diff: printing/print_settings_initializer_mac.cc

Issue 1343593002: Cleanup code in printing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | no next file » | 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/print_settings_initializer_mac.h" 5 #include "printing/print_settings_initializer_mac.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "printing/print_settings.h" 8 #include "printing/print_settings.h"
9 #include "printing/units.h" 9 #include "printing/units.h"
10 10
(...skipping 10 matching lines...) Expand all
21 PMOrientation orientation = kPMPortrait; 21 PMOrientation orientation = kPMPortrait;
22 PMGetOrientation(page_format, &orientation); 22 PMGetOrientation(page_format, &orientation);
23 print_settings->SetOrientation(orientation == kPMLandscape); 23 print_settings->SetOrientation(orientation == kPMLandscape);
24 24
25 UInt32 resolution_count = 0; 25 UInt32 resolution_count = 0;
26 PMResolution best_resolution = { 72.0, 72.0 }; 26 PMResolution best_resolution = { 72.0, 72.0 };
27 OSStatus status = PMPrinterGetPrinterResolutionCount(printer, 27 OSStatus status = PMPrinterGetPrinterResolutionCount(printer,
28 &resolution_count); 28 &resolution_count);
29 if (status == noErr) { 29 if (status == noErr) {
30 // Resolution indexes are 1-based. 30 // Resolution indexes are 1-based.
31 for (uint32 i = 1; i <= resolution_count; ++i) { 31 for (uint32_t i = 1; i <= resolution_count; ++i) {
32 PMResolution resolution; 32 PMResolution resolution;
33 PMPrinterGetIndexedPrinterResolution(printer, i, &resolution); 33 PMPrinterGetIndexedPrinterResolution(printer, i, &resolution);
34 if (resolution.hRes > best_resolution.hRes) 34 if (resolution.hRes > best_resolution.hRes)
35 best_resolution = resolution; 35 best_resolution = resolution;
36 } 36 }
37 } 37 }
38 int dpi = best_resolution.hRes; 38 int dpi = best_resolution.hRes;
39 print_settings->set_dpi(dpi); 39 print_settings->set_dpi(dpi);
40 40
41 DCHECK_EQ(dpi, best_resolution.vRes); 41 DCHECK_EQ(dpi, best_resolution.vRes);
(...skipping 13 matching lines...) Expand all
55 (page_rect.right - page_rect.left), 55 (page_rect.right - page_rect.left),
56 (page_rect.bottom - page_rect.top)); 56 (page_rect.bottom - page_rect.top));
57 57
58 DCHECK_EQ(print_settings->device_units_per_inch(), kPointsPerInch); 58 DCHECK_EQ(print_settings->device_units_per_inch(), kPointsPerInch);
59 print_settings->SetPrinterPrintableArea(physical_size_device_units, 59 print_settings->SetPrinterPrintableArea(physical_size_device_units,
60 printable_area_device_units, 60 printable_area_device_units,
61 false); 61 false);
62 } 62 }
63 63
64 } // namespace printing 64 } // namespace printing
OLDNEW
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698