Chromium Code Reviews| 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.h" | 5 #include "printing/printing_context.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "printing/page_setup.h" | 9 #include "printing/page_setup.h" |
| 10 #include "printing/page_size_margins.h" | 10 #include "printing/page_size_margins.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 is_cloud_dialog || print_with_privet)) { | 78 is_cloud_dialog || print_with_privet)) { |
| 79 settings_.set_dpi(kDefaultPdfDpi); | 79 settings_.set_dpi(kDefaultPdfDpi); |
| 80 gfx::Size paper_size(GetPdfPaperSizeDeviceUnits()); | 80 gfx::Size paper_size(GetPdfPaperSizeDeviceUnits()); |
| 81 const base::DictionaryValue* media_size = NULL; | 81 const base::DictionaryValue* media_size = NULL; |
| 82 if (job_settings.GetDictionary(kSettingMediaSize, &media_size)) { | 82 if (job_settings.GetDictionary(kSettingMediaSize, &media_size)) { |
| 83 int width_microns = 0; | 83 int width_microns = 0; |
| 84 int height_microns = 0; | 84 int height_microns = 0; |
| 85 if (media_size->GetInteger(kSettingMediaSizeWidthMicrons, | 85 if (media_size->GetInteger(kSettingMediaSizeWidthMicrons, |
| 86 &width_microns) && | 86 &width_microns) && |
| 87 media_size->GetInteger(kSettingMediaSizeHeightMicrons, | 87 media_size->GetInteger(kSettingMediaSizeHeightMicrons, |
| 88 &height_microns)) { | 88 &height_microns) && |
| 89 settings_.device_units_per_inch() > 0) { | |
|
Vitaly Buka (NO REVIEWS)
2014/05/20 22:52:19
how is this possible?
| |
| 89 float deviceMicronsPerDeviceUnit = | 90 float deviceMicronsPerDeviceUnit = |
| 90 (kHundrethsMMPerInch * 10.0f) / settings_.device_units_per_inch(); | 91 (kHundrethsMMPerInch * 10.0f) / settings_.device_units_per_inch(); |
| 91 paper_size = gfx::Size(width_microns / deviceMicronsPerDeviceUnit, | 92 paper_size = gfx::Size(width_microns / deviceMicronsPerDeviceUnit, |
| 92 height_microns / deviceMicronsPerDeviceUnit); | 93 height_microns / deviceMicronsPerDeviceUnit); |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 gfx::Rect paper_rect(0, 0, paper_size.width(), paper_size.height()); | 96 gfx::Rect paper_rect(0, 0, paper_size.width(), paper_size.height()); |
| 96 if (print_to_cloud || print_with_privet) { | 97 if (print_to_cloud || print_with_privet) { |
| 97 paper_rect.Inset( | 98 paper_rect.Inset( |
| 98 kCloudPrintMarginInch * settings_.device_units_per_inch(), | 99 kCloudPrintMarginInch * settings_.device_units_per_inch(), |
| 99 kCloudPrintMarginInch * settings_.device_units_per_inch()); | 100 kCloudPrintMarginInch * settings_.device_units_per_inch()); |
| 100 } | 101 } |
| 101 settings_.SetPrinterPrintableArea(paper_size, paper_rect, true); | 102 settings_.SetPrinterPrintableArea(paper_size, paper_rect, true); |
| 102 return OK; | 103 return OK; |
| 103 } | 104 } |
| 104 | 105 |
| 105 return UpdatePrinterSettings(open_in_external_preview); | 106 return UpdatePrinterSettings(open_in_external_preview); |
| 106 } | 107 } |
| 107 | 108 |
| 108 } // namespace printing | 109 } // namespace printing |
| OLD | NEW |