| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
| 6 | 6 |
| 7 #include <objidl.h> | 7 #include <objidl.h> |
| 8 #include <winspool.h> | 8 #include <winspool.h> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 NOTREACHED(); | 376 NOTREACHED(); |
| 377 return false; | 377 return false; |
| 378 } | 378 } |
| 379 last_page_printed_ = -1; | 379 last_page_printed_ = -1; |
| 380 // We only support PDFs for now. | 380 // We only support PDFs for now. |
| 381 if (print_data_mime_type != "application/pdf") { | 381 if (print_data_mime_type != "application/pdf") { |
| 382 NOTREACHED(); | 382 NOTREACHED(); |
| 383 return false; | 383 return false; |
| 384 } | 384 } |
| 385 | 385 |
| 386 if (!printing::XPSModule::Init()) { | 386 printing::ScopedXPSInitializer xps_initializer; |
| 387 if (!xps_initializer.initialized()) { |
| 387 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) | 388 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) |
| 388 return false; | 389 return false; |
| 389 } | 390 } |
| 390 DevMode pt_dev_mode; | 391 DevMode pt_dev_mode; |
| 391 HRESULT hr = PrintTicketToDevMode(printer_name, print_ticket, | 392 HRESULT hr = PrintTicketToDevMode(printer_name, print_ticket, |
| 392 &pt_dev_mode); | 393 &pt_dev_mode); |
| 393 if (FAILED(hr)) { | 394 if (FAILED(hr)) { |
| 394 NOTREACHED(); | 395 NOTREACHED(); |
| 395 return false; | 396 return false; |
| 396 } | 397 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 handler->Start(); | 612 handler->Start(); |
| 612 } | 613 } |
| 613 | 614 |
| 614 bool PrintSystemWin::IsValidPrinter(const std::string& printer_name) { | 615 bool PrintSystemWin::IsValidPrinter(const std::string& printer_name) { |
| 615 return print_backend_->IsValidPrinter(printer_name); | 616 return print_backend_->IsValidPrinter(printer_name); |
| 616 } | 617 } |
| 617 | 618 |
| 618 bool PrintSystemWin::ValidatePrintTicket( | 619 bool PrintSystemWin::ValidatePrintTicket( |
| 619 const std::string& printer_name, | 620 const std::string& printer_name, |
| 620 const std::string& print_ticket_data) { | 621 const std::string& print_ticket_data) { |
| 621 if (!printing::XPSModule::Init()) { | 622 printing::ScopedXPSInitializer xps_initializer; |
| 623 if (!xps_initializer.initialized()) { |
| 622 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) | 624 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) |
| 623 return false; | 625 return false; |
| 624 } | 626 } |
| 625 bool ret = false; | 627 bool ret = false; |
| 626 HPTPROVIDER provider = NULL; | 628 HPTPROVIDER provider = NULL; |
| 627 printing::XPSModule::OpenProvider(UTF8ToWide(printer_name.c_str()), | 629 printing::XPSModule::OpenProvider(UTF8ToWide(printer_name.c_str()), |
| 628 1, | 630 1, |
| 629 &provider); | 631 &provider); |
| 630 if (provider) { | 632 if (provider) { |
| 631 ScopedComPtr<IStream> print_ticket_stream; | 633 ScopedComPtr<IStream> print_ticket_stream; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); | 728 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); |
| 727 return ret; | 729 return ret; |
| 728 } | 730 } |
| 729 | 731 |
| 730 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 732 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
| 731 const DictionaryValue* print_system_settings) { | 733 const DictionaryValue* print_system_settings) { |
| 732 return new PrintSystemWin; | 734 return new PrintSystemWin; |
| 733 } | 735 } |
| 734 | 736 |
| 735 } // namespace cloud_print | 737 } // namespace cloud_print |
| OLD | NEW |