Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 6356007: Added a diagnostic user message when enumerating printers fails. Also tweaked... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code review changes Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_cups.cc ('k') | chrome/service/cloud_print/printer_job_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698