| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 5 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "printing/printing_context.h" | 9 #include "printing/printing_context.h" |
| 10 #include "printing/units.h" | 10 #include "printing/units.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 #if defined(ENABLE_PRINTING) | 16 #if defined(ENABLE_PRINTING) |
| 17 // Print units conversion functions. | 17 // Print units conversion functions. |
| 18 int32_t DeviceUnitsInPoints(int32_t device_units, | 18 int32_t DeviceUnitsInPoints(int32_t device_units, |
| 19 int32_t device_units_per_inch) { | 19 int32_t device_units_per_inch) { |
| 20 return printing::ConvertUnit(device_units, printing::kPointsPerInch, | 20 return printing::ConvertUnit(device_units, device_units_per_inch, |
| 21 device_units_per_inch); | 21 printing::kPointsPerInch); |
| 22 } | 22 } |
| 23 | 23 |
| 24 PP_Size PrintSizeToPPPrintSize(const gfx::Size& print_size, | 24 PP_Size PrintSizeToPPPrintSize(const gfx::Size& print_size, |
| 25 int32_t device_units_per_inch) { | 25 int32_t device_units_per_inch) { |
| 26 PP_Size result; | 26 PP_Size result; |
| 27 result.width = DeviceUnitsInPoints(print_size.width(), device_units_per_inch); | 27 result.width = DeviceUnitsInPoints(print_size.width(), device_units_per_inch); |
| 28 result.height = DeviceUnitsInPoints(print_size.height(), | 28 result.height = DeviceUnitsInPoints(print_size.height(), |
| 29 device_units_per_inch); | 29 device_units_per_inch); |
| 30 return result; | 30 return result; |
| 31 } | 31 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 } // namespace | 89 } // namespace |
| 90 | 90 |
| 91 void PepperPrintSettingsManagerImpl::GetDefaultPrintSettings( | 91 void PepperPrintSettingsManagerImpl::GetDefaultPrintSettings( |
| 92 PepperPrintSettingsManager::Callback callback) { | 92 PepperPrintSettingsManager::Callback callback) { |
| 93 BrowserThread::PostTaskAndReplyWithResult(BrowserThread::UI, FROM_HERE, | 93 BrowserThread::PostTaskAndReplyWithResult(BrowserThread::UI, FROM_HERE, |
| 94 base::Bind(ComputeDefaultPrintSettings), callback); | 94 base::Bind(ComputeDefaultPrintSettings), callback); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace content | 97 } // namespace content |
| OLD | NEW |