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

Unified Diff: chrome/service/cloud_print/cdd_conversion_win.cc

Issue 333993003: Add paper size support for printing to local printer on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mon 06/16/2014 11:56:53.27 Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | printing/backend/print_backend_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/cdd_conversion_win.cc
diff --git a/chrome/service/cloud_print/cdd_conversion_win.cc b/chrome/service/cloud_print/cdd_conversion_win.cc
index bfcb9202a40792c8cb6b310a519b72817cee963b..4ab9c46e52b7a094a1141f98ae74da71a6b39456 100644
--- a/chrome/service/cloud_print/cdd_conversion_win.cc
+++ b/chrome/service/cloud_print/cdd_conversion_win.cc
@@ -4,6 +4,7 @@
#include "chrome/service/cloud_print/cdd_conversion_win.h"
+#include "base/strings/string_number_conversions.h"
#include "components/cloud_devices/common/printer_description.h"
#include "printing/backend/win_helper.h"
@@ -111,11 +112,13 @@ scoped_ptr<DEVMODE, base::FreeDeleter> CjtToDevMode(
static const size_t kFromUm = 100; // Windows uses 0.1mm.
int width = media.value().width_um / kFromUm;
int height = media.value().height_um / kFromUm;
- if (width > 0) {
+ unsigned id = 0;
+ if (base::StringToUint(media.value().vendor_id, &id) && id) {
+ dev_mode->dmFields |= DM_PAPERSIZE;
+ dev_mode->dmPaperSize = static_cast<short>(id);
+ } else if (width > 0 && height > 0) {
dev_mode->dmFields |= DM_PAPERWIDTH;
dev_mode->dmPaperWidth = width;
- }
- if (height > 0) {
dev_mode->dmFields |= DM_PAPERLENGTH;
dev_mode->dmPaperLength = height;
}
« no previous file with comments | « no previous file | printing/backend/print_backend_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698