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

Side by Side Diff: printing/printing_context_no_system_dialog.cc

Issue 10834217: Fix issue with some locales simetimes getting the wrong page size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | 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/printing_context_no_system_dialog.h" 5 #include "printing/printing_context_no_system_dialog.h"
6 6
7 #include <unicode/ulocdata.h> 7 #include <unicode/ulocdata.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // bug 102583. 45 // bug 102583.
46 // TODO(sanjeevr): We need a better feedback loop between the cloud print 46 // TODO(sanjeevr): We need a better feedback loop between the cloud print
47 // dialog and this code. 47 // dialog and this code.
48 int dpi = 300; 48 int dpi = 300;
49 gfx::Size physical_size_device_units; 49 gfx::Size physical_size_device_units;
50 gfx::Rect printable_area_device_units; 50 gfx::Rect printable_area_device_units;
51 int32_t width = 0; 51 int32_t width = 0;
52 int32_t height = 0; 52 int32_t height = 0;
53 UErrorCode error = U_ZERO_ERROR; 53 UErrorCode error = U_ZERO_ERROR;
54 ulocdata_getPaperSize(app_locale_.c_str(), &height, &width, &error); 54 ulocdata_getPaperSize(app_locale_.c_str(), &height, &width, &error);
55 if (error != U_ZERO_ERROR) { 55 if (error > U_ZERO_ERROR) {
56 // If the call failed, assume a paper size of 8.5 x 11 inches. 56 // If the call failed, assume a paper size of 8.5 x 11 inches.
57 LOG(WARNING) << "ulocdata_getPaperSize failed, using 8.5 x 11, error: " 57 LOG(WARNING) << "ulocdata_getPaperSize failed, using 8.5 x 11, error: "
58 << error; 58 << error;
59 width = static_cast<int>(8.5 * dpi); 59 width = static_cast<int>(8.5 * dpi);
60 height = static_cast<int>(11 * dpi); 60 height = static_cast<int>(11 * dpi);
61 } else { 61 } else {
62 // ulocdata_getPaperSize returns the width and height in mm. 62 // ulocdata_getPaperSize returns the width and height in mm.
63 // Convert this to pixels based on the dpi. 63 // Convert this to pixels based on the dpi.
64 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi); 64 width = static_cast<int>(ConvertUnitDouble(width, 25.4, 1.0) * dpi);
65 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi); 65 height = static_cast<int>(ConvertUnitDouble(height, 25.4, 1.0) * dpi);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Intentional No-op. 149 // Intentional No-op.
150 } 150 }
151 151
152 gfx::NativeDrawingContext PrintingContextNoSystemDialog::context() const { 152 gfx::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
153 // Intentional No-op. 153 // Intentional No-op.
154 return NULL; 154 return NULL;
155 } 155 }
156 156
157 } // namespace printing 157 } // namespace printing
158 158
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698