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 "printing/backend/win_helper.h" | 5 #include "printing/backend/win_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 printing::XPSModule::CloseProvider(provider); | 425 printing::XPSModule::CloseProvider(provider); |
426 } | 426 } |
427 return scoped_dev_mode.Pass(); | 427 return scoped_dev_mode.Pass(); |
428 } | 428 } |
429 | 429 |
430 scoped_ptr<DEVMODE[]> CreateDevModeWithColor(HANDLE printer, | 430 scoped_ptr<DEVMODE[]> CreateDevModeWithColor(HANDLE printer, |
431 const base::string16& printer_name, | 431 const base::string16& printer_name, |
432 bool color) { | 432 bool color) { |
433 scoped_ptr<DEVMODE[]> default = CreateDevMode(printer, NULL); | 433 scoped_ptr<DEVMODE[]> default = CreateDevMode(printer, NULL); |
434 if (default && (default.get()->dmFields & DM_COLOR) && | 434 if (default && (default.get()->dmFields & DM_COLOR) && |
435 (default.get()->dmColor == DMCOLOR_COLOR) == color) { | 435 ((default.get()->dmColor == DMCOLOR_COLOR) == color)) { |
436 return default.Pass(); | 436 return default.Pass(); |
437 } | 437 } |
438 | 438 |
439 default.get()->dmFields |= DM_COLOR; | 439 default.get()->dmFields |= DM_COLOR; |
440 default.get()->dmColor = color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; | 440 default.get()->dmColor = color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; |
441 | 441 |
442 DriverInfo6 info_6; | 442 DriverInfo6 info_6; |
443 if (!info_6.Init(printer)) | 443 if (!info_6.Init(printer)) |
444 return default.Pass(); | 444 return default.Pass(); |
445 | 445 |
(...skipping 27 matching lines...) Expand all Loading... |
473 scoped_ptr<DEVMODE[]> out( | 473 scoped_ptr<DEVMODE[]> out( |
474 reinterpret_cast<DEVMODE*>(new uint8[buffer_size])); | 474 reinterpret_cast<DEVMODE*>(new uint8[buffer_size])); |
475 flags |= DM_OUT_BUFFER; | 475 flags |= DM_OUT_BUFFER; |
476 if (DocumentProperties(NULL, printer, L"", out.get(), in, flags) != IDOK) | 476 if (DocumentProperties(NULL, printer, L"", out.get(), in, flags) != IDOK) |
477 return scoped_ptr<DEVMODE[]>(); | 477 return scoped_ptr<DEVMODE[]>(); |
478 DCHECK_EQ(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); | 478 DCHECK_EQ(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); |
479 return out.Pass(); | 479 return out.Pass(); |
480 } | 480 } |
481 | 481 |
482 } // namespace printing | 482 } // namespace printing |
OLD | NEW |