| 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_win.h" | 5 #include "printing/printing_context_win.h" |
| 6 | 6 |
| 7 #include <winspool.h> | 7 #include <winspool.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 dev_mode->dmCopies = std::max(copies, 1); | 376 dev_mode->dmCopies = std::max(copies, 1); |
| 377 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies | 377 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies |
| 378 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; | 378 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; |
| 379 switch (duplex_mode) { | 379 switch (duplex_mode) { |
| 380 case LONG_EDGE: | 380 case LONG_EDGE: |
| 381 dev_mode->dmDuplex = DMDUP_VERTICAL; | 381 dev_mode->dmDuplex = DMDUP_VERTICAL; |
| 382 break; | 382 break; |
| 383 case SHORT_EDGE: | 383 case SHORT_EDGE: |
| 384 dev_mode->dmDuplex = DMDUP_HORIZONTAL; | 384 dev_mode->dmDuplex = DMDUP_HORIZONTAL; |
| 385 break; | 385 break; |
| 386 default: // simplex | 386 case SIMPLEX: |
| 387 dev_mode->dmDuplex = DMDUP_SIMPLEX; | 387 dev_mode->dmDuplex = DMDUP_SIMPLEX; |
| 388 break; | 388 break; |
| 389 default: // UNKNOWN_DUPLEX_MODE |
| 390 break; |
| 389 } | 391 } |
| 390 dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; | 392 dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; |
| 391 | 393 |
| 392 // Update data using DocumentProperties. | 394 // Update data using DocumentProperties. |
| 393 if (DocumentProperties(NULL, printer, device_name_wide, dev_mode, dev_mode, | 395 if (DocumentProperties(NULL, printer, device_name_wide, dev_mode, dev_mode, |
| 394 DM_IN_BUFFER | DM_OUT_BUFFER) != IDOK) { | 396 DM_IN_BUFFER | DM_OUT_BUFFER) != IDOK) { |
| 395 ClosePrinter(printer); | 397 ClosePrinter(printer); |
| 396 return OnError(); | 398 return OnError(); |
| 397 } | 399 } |
| 398 | 400 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 if (buf_size) { | 765 if (buf_size) { |
| 764 buffer->reset(new uint8[buf_size]); | 766 buffer->reset(new uint8[buf_size]); |
| 765 memset(buffer->get(), 0, buf_size); | 767 memset(buffer->get(), 0, buf_size); |
| 766 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 768 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
| 767 buffer->reset(); | 769 buffer->reset(); |
| 768 } | 770 } |
| 769 } | 771 } |
| 770 } | 772 } |
| 771 | 773 |
| 772 } // namespace printing | 774 } // namespace printing |
| OLD | NEW |