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

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

Issue 4233004: Make CUPS cloud print proxy to support multiple print servers.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 <prntvpt.h> 8 #include <prntvpt.h>
9 #include <winspool.h> 9 #include <winspool.h>
10 10
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Visual Studio where it gets confused between multiple Delegate. 232 // Visual Studio where it gets confused between multiple Delegate.
233 // In this case, some compilers get confused and inherit 233 // In this case, some compilers get confused and inherit
234 // PrintSystemWin watchers from wrong Delegate, giving C2664 and C2259 errors. 234 // PrintSystemWin watchers from wrong Delegate, giving C2664 and C2259 errors.
235 typedef PrintSystemWatcherWin::Delegate PrintSystemWatcherWinDelegate; 235 typedef PrintSystemWatcherWin::Delegate PrintSystemWatcherWinDelegate;
236 236
237 class PrintSystemWin : public PrintSystem { 237 class PrintSystemWin : public PrintSystem {
238 public: 238 public:
239 PrintSystemWin(); 239 PrintSystemWin();
240 240
241 // PrintSystem implementation. 241 // PrintSystem implementation.
242 virtual printing::PrintBackend* GetPrintBackend(); 242 virtual void Init();
243
244 virtual void EnumeratePrinters(printing::PrinterList* printer_list);
245
246 virtual bool GetPrinterCapsAndDefaults(
247 const std::string& printer_name,
248 printing::PrinterCapsAndDefaults* printer_info);
249
250 virtual bool IsValidPrinter(const std::string& printer_name);
243 251
244 virtual bool ValidatePrintTicket(const std::string& printer_name, 252 virtual bool ValidatePrintTicket(const std::string& printer_name,
245 const std::string& print_ticket_data); 253 const std::string& print_ticket_data);
246 254
247 virtual bool GetJobDetails(const std::string& printer_name, 255 virtual bool GetJobDetails(const std::string& printer_name,
248 PlatformJobId job_id, 256 PlatformJobId job_id,
249 PrintJobDetails *job_details); 257 PrintJobDetails *job_details);
250 258
251 class PrintServerWatcherWin 259 class PrintServerWatcherWin
252 : public PrintSystem::PrintServerWatcher, 260 : public PrintSystem::PrintServerWatcher,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 scoped_refptr<Core> core_; 509 scoped_refptr<Core> core_;
502 DISALLOW_COPY_AND_ASSIGN(JobSpoolerWin); 510 DISALLOW_COPY_AND_ASSIGN(JobSpoolerWin);
503 }; 511 };
504 512
505 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher(); 513 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher();
506 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher( 514 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher(
507 const std::string& printer_name); 515 const std::string& printer_name);
508 virtual PrintSystem::JobSpooler* CreateJobSpooler(); 516 virtual PrintSystem::JobSpooler* CreateJobSpooler();
509 517
510 private: 518 private:
511 void Init();
512
513 scoped_refptr<printing::PrintBackend> print_backend_; 519 scoped_refptr<printing::PrintBackend> print_backend_;
514 }; 520 };
515 521
516 PrintSystemWin::PrintSystemWin() { 522 PrintSystemWin::PrintSystemWin() {
517 Init(); 523 print_backend_ = printing::PrintBackend::CreateInstance(NULL);
518 } 524 }
519 525
520 void PrintSystemWin::Init() { 526 void PrintSystemWin::Init() {
521 print_backend_ = printing::PrintBackend::CreateInstance(NULL);
522 } 527 }
523 528
524 printing::PrintBackend* PrintSystemWin::GetPrintBackend() { 529 void PrintSystemWin::EnumeratePrinters(printing::PrinterList* printer_list) {
525 return print_backend_; 530 print_backend_->EnumeratePrinters(printer_list);
531 }
532
533 bool PrintSystemWin::GetPrinterCapsAndDefaults(
534 const std::string& printer_name,
535 printing::PrinterCapsAndDefaults* printer_info) {
536 return print_backend_->GetPrinterCapsAndDefaults(printer_name, printer_info);
537 }
538
539 bool PrintSystemWin::IsValidPrinter(const std::string& printer_name) {
540 return print_backend_->IsValidPrinter(printer_name);
526 } 541 }
527 542
528 bool PrintSystemWin::ValidatePrintTicket( 543 bool PrintSystemWin::ValidatePrintTicket(
529 const std::string& printer_name, 544 const std::string& printer_name,
530 const std::string& print_ticket_data) { 545 const std::string& print_ticket_data) {
531 if (!printing::InitXPSModule()) { 546 if (!printing::InitXPSModule()) {
532 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll) 547 // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll)
533 return false; 548 return false;
534 } 549 }
535 bool ret = false; 550 bool ret = false;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); 648 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string));
634 return ret; 649 return ret;
635 } 650 }
636 651
637 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 652 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
638 const DictionaryValue* print_system_settings) { 653 const DictionaryValue* print_system_settings) {
639 return new PrintSystemWin; 654 return new PrintSystemWin;
640 } 655 }
641 656
642 } // namespace cloud_print 657 } // 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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698