| OLD | NEW |
| 1 // Copyright (c) 2010 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/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "printing/print_settings.h" | 8 #include "printing/print_settings.h" |
| 9 | 9 |
| 10 namespace printing { | 10 namespace printing { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 void PrintSettingsInitializerMac::InitPrintSettings( | 13 void PrintSettingsInitializerMac::InitPrintSettings( |
| 14 PMPrinter printer, | 14 PMPrinter printer, |
| 15 PMPageFormat page_format, | 15 PMPageFormat page_format, |
| 16 const PageRanges& new_ranges, | 16 const PageRanges& new_ranges, |
| 17 bool print_selection_only, | 17 bool print_selection_only, |
| 18 PrintSettings* print_settings) { | 18 PrintSettings* print_settings) { |
| 19 DCHECK(print_settings); | 19 DCHECK(print_settings); |
| 20 | 20 |
| 21 print_settings->set_printer_name( | 21 print_settings->set_printer_name( |
| 22 base::SysCFStringRefToWide(PMPrinterGetName(printer))); | 22 base::SysCFStringRefToUTF16(PMPrinterGetName(printer))); |
| 23 print_settings->set_device_name( | 23 print_settings->set_device_name( |
| 24 base::SysCFStringRefToWide(PMPrinterGetID(printer))); | 24 base::SysCFStringRefToUTF16(PMPrinterGetID(printer))); |
| 25 print_settings->ranges = new_ranges; | 25 print_settings->ranges = new_ranges; |
| 26 | 26 |
| 27 PMOrientation orientation = kPMPortrait; | 27 PMOrientation orientation = kPMPortrait; |
| 28 PMGetOrientation(page_format, &orientation); | 28 PMGetOrientation(page_format, &orientation); |
| 29 print_settings->set_landscape(orientation == kPMLandscape); | 29 print_settings->set_landscape(orientation == kPMLandscape); |
| 30 print_settings->selection_only = print_selection_only; | 30 print_settings->selection_only = print_selection_only; |
| 31 | 31 |
| 32 UInt32 resolution_count = 0; | 32 UInt32 resolution_count = 0; |
| 33 PMResolution best_resolution = { 72.0, 72.0 }; | 33 PMResolution best_resolution = { 72.0, 72.0 }; |
| 34 OSStatus status = PMPrinterGetPrinterResolutionCount(printer, | 34 OSStatus status = PMPrinterGetPrinterResolutionCount(printer, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 (page_rect.top - paper_rect.top), | 61 (page_rect.top - paper_rect.top), |
| 62 (page_rect.right - page_rect.left), | 62 (page_rect.right - page_rect.left), |
| 63 (page_rect.bottom - page_rect.top)); | 63 (page_rect.bottom - page_rect.top)); |
| 64 | 64 |
| 65 print_settings->SetPrinterPrintableArea(physical_size_device_units, | 65 print_settings->SetPrinterPrintableArea(physical_size_device_units, |
| 66 printable_area_device_units, | 66 printable_area_device_units, |
| 67 72); | 67 72); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace printing | 70 } // namespace printing |
| OLD | NEW |