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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (!xps_initializer.initialized()) { | 398 if (!xps_initializer.initialized()) { |
399 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) | 399 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) |
400 return dev_mode; | 400 return dev_mode; |
401 } | 401 } |
402 | 402 |
403 printing::ScopedPrinterHandle printer; | 403 printing::ScopedPrinterHandle printer; |
404 if (!printer.OpenPrinter(printer_name.c_str())) | 404 if (!printer.OpenPrinter(printer_name.c_str())) |
405 return dev_mode; | 405 return dev_mode; |
406 | 406 |
407 base::win::ScopedComPtr<IStream> pt_stream; | 407 base::win::ScopedComPtr<IStream> pt_stream; |
408 HRESULT hr = StreamFromPrintTicket(print_ticket, pt_stream.Receive()); | 408 HRESULT hr = StreamFromPrintTicket(print_ticket, pt_stream.GetAddressOf()); |
409 if (FAILED(hr)) | 409 if (FAILED(hr)) |
410 return dev_mode; | 410 return dev_mode; |
411 | 411 |
412 HPTPROVIDER provider = NULL; | 412 HPTPROVIDER provider = NULL; |
413 hr = printing::XPSModule::OpenProvider(printer_name, 1, &provider); | 413 hr = printing::XPSModule::OpenProvider(printer_name, 1, &provider); |
414 if (SUCCEEDED(hr)) { | 414 if (SUCCEEDED(hr)) { |
415 ULONG size = 0; | 415 ULONG size = 0; |
416 DEVMODE* dm = NULL; | 416 DEVMODE* dm = NULL; |
417 // Use kPTJobScope, because kPTDocumentScope breaks duplex. | 417 // Use kPTJobScope, because kPTDocumentScope breaks duplex. |
418 hr = printing::XPSModule::ConvertPrintTicketToDevMode( | 418 hr = printing::XPSModule::ConvertPrintTicketToDevMode( |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 *canceled = (result == IDCANCEL); | 553 *canceled = (result == IDCANCEL); |
554 if (result != IDOK) | 554 if (result != IDOK) |
555 return std::unique_ptr<DEVMODE, base::FreeDeleter>(); | 555 return std::unique_ptr<DEVMODE, base::FreeDeleter>(); |
556 int size = out->dmSize; | 556 int size = out->dmSize; |
557 int extra_size = out->dmDriverExtra; | 557 int extra_size = out->dmDriverExtra; |
558 CHECK_GE(buffer_size, size + extra_size); | 558 CHECK_GE(buffer_size, size + extra_size); |
559 return out; | 559 return out; |
560 } | 560 } |
561 | 561 |
562 } // namespace printing | 562 } // namespace printing |
OLD | NEW |