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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // PrintSystemWin watchers from wrong Delegate, giving C2664 and C2259 errors. | 243 // PrintSystemWin watchers from wrong Delegate, giving C2664 and C2259 errors. |
244 typedef PrintSystemWatcherWin::Delegate PrintSystemWatcherWinDelegate; | 244 typedef PrintSystemWatcherWin::Delegate PrintSystemWatcherWinDelegate; |
245 | 245 |
246 class PrintSystemWin : public PrintSystem { | 246 class PrintSystemWin : public PrintSystem { |
247 public: | 247 public: |
248 PrintSystemWin(); | 248 PrintSystemWin(); |
249 | 249 |
250 // PrintSystem implementation. | 250 // PrintSystem implementation. |
251 virtual PrintSystemResult Init(); | 251 virtual PrintSystemResult Init(); |
252 | 252 |
253 virtual void EnumeratePrinters(printing::PrinterList* printer_list); | 253 virtual PrintSystem::PrintSystemResult EnumeratePrinters( |
| 254 printing::PrinterList* printer_list); |
254 | 255 |
255 virtual void GetPrinterCapsAndDefaults( | 256 virtual void GetPrinterCapsAndDefaults( |
256 const std::string& printer_name, | 257 const std::string& printer_name, |
257 PrinterCapsAndDefaultsCallback* callback); | 258 PrinterCapsAndDefaultsCallback* callback); |
258 | 259 |
259 virtual bool IsValidPrinter(const std::string& printer_name); | 260 virtual bool IsValidPrinter(const std::string& printer_name); |
260 | 261 |
261 virtual bool ValidatePrintTicket(const std::string& printer_name, | 262 virtual bool ValidatePrintTicket(const std::string& printer_name, |
262 const std::string& print_ticket_data); | 263 const std::string& print_ticket_data); |
263 | 264 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 599 |
599 PrintSystem::PrintSystemResult PrintSystemWin::Init() { | 600 PrintSystem::PrintSystemResult PrintSystemWin::Init() { |
600 if (!printing::XPSModule::Init()) { | 601 if (!printing::XPSModule::Init()) { |
601 std::string message = l10n_util::GetStringUTF8( | 602 std::string message = l10n_util::GetStringUTF8( |
602 IDS_CLOUD_PRINT_XPS_UNAVAILABLE); | 603 IDS_CLOUD_PRINT_XPS_UNAVAILABLE); |
603 return PrintSystemResult(false, message); | 604 return PrintSystemResult(false, message); |
604 } | 605 } |
605 return PrintSystemResult(true, std::string()); | 606 return PrintSystemResult(true, std::string()); |
606 } | 607 } |
607 | 608 |
608 void PrintSystemWin::EnumeratePrinters(printing::PrinterList* printer_list) { | 609 PrintSystem::PrintSystemResult PrintSystemWin::EnumeratePrinters( |
609 print_backend_->EnumeratePrinters(printer_list); | 610 printing::PrinterList* printer_list) { |
| 611 bool ret = print_backend_->EnumeratePrinters(printer_list); |
| 612 return PrintSystemResult(ret, std::string()); |
610 } | 613 } |
611 | 614 |
612 void PrintSystemWin::GetPrinterCapsAndDefaults( | 615 void PrintSystemWin::GetPrinterCapsAndDefaults( |
613 const std::string& printer_name, | 616 const std::string& printer_name, |
614 PrinterCapsAndDefaultsCallback* callback) { | 617 PrinterCapsAndDefaultsCallback* callback) { |
615 // Launch as child process to retrieve the capabilities and defaults because | 618 // Launch as child process to retrieve the capabilities and defaults because |
616 // this involves invoking a printer driver DLL and crashes have been known to | 619 // this involves invoking a printer driver DLL and crashes have been known to |
617 // occur. | 620 // occur. |
618 PrinterCapsHandler* handler = | 621 PrinterCapsHandler* handler = |
619 new PrinterCapsHandler(printer_name, callback); | 622 new PrinterCapsHandler(printer_name, callback); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); | 740 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); |
738 return ret; | 741 return ret; |
739 } | 742 } |
740 | 743 |
741 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 744 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
742 const DictionaryValue* print_system_settings) { | 745 const DictionaryValue* print_system_settings) { |
743 return new PrintSystemWin; | 746 return new PrintSystemWin; |
744 } | 747 } |
745 | 748 |
746 } // namespace cloud_print | 749 } // namespace cloud_print |
OLD | NEW |