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 "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 #include <xpsprint.h> | 9 #include <xpsprint.h> |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 | 284 |
285 // PrintSystemWatcherWin::Delegate implementation. | 285 // PrintSystemWatcherWin::Delegate implementation. |
286 virtual void OnPrinterAdded() OVERRIDE { | 286 virtual void OnPrinterAdded() OVERRIDE { |
287 delegate_->OnPrinterAdded(); | 287 delegate_->OnPrinterAdded(); |
288 } | 288 } |
289 virtual void OnPrinterDeleted() OVERRIDE {} | 289 virtual void OnPrinterDeleted() OVERRIDE {} |
290 virtual void OnPrinterChanged() OVERRIDE {} | 290 virtual void OnPrinterChanged() OVERRIDE {} |
291 virtual void OnJobChanged() OVERRIDE {} | 291 virtual void OnJobChanged() OVERRIDE {} |
292 | 292 |
| 293 protected: |
| 294 virtual ~PrintServerWatcherWin() {} |
| 295 |
293 private: | 296 private: |
294 PrintSystem::PrintServerWatcher::Delegate* delegate_; | 297 PrintSystem::PrintServerWatcher::Delegate* delegate_; |
295 PrintSystemWatcherWin watcher_; | 298 PrintSystemWatcherWin watcher_; |
296 | 299 |
297 DISALLOW_COPY_AND_ASSIGN(PrintServerWatcherWin); | 300 DISALLOW_COPY_AND_ASSIGN(PrintServerWatcherWin); |
298 }; | 301 }; |
299 | 302 |
300 class PrinterWatcherWin | 303 class PrinterWatcherWin |
301 : public PrintSystem::PrinterWatcher, | 304 : public PrintSystem::PrinterWatcher, |
302 public PrintSystemWatcherWinDelegate { | 305 public PrintSystemWatcherWinDelegate { |
(...skipping 28 matching lines...) Expand all Loading... |
331 virtual void OnPrinterDeleted() OVERRIDE { | 334 virtual void OnPrinterDeleted() OVERRIDE { |
332 delegate_->OnPrinterDeleted(); | 335 delegate_->OnPrinterDeleted(); |
333 } | 336 } |
334 virtual void OnPrinterChanged() OVERRIDE { | 337 virtual void OnPrinterChanged() OVERRIDE { |
335 delegate_->OnPrinterChanged(); | 338 delegate_->OnPrinterChanged(); |
336 } | 339 } |
337 virtual void OnJobChanged() OVERRIDE { | 340 virtual void OnJobChanged() OVERRIDE { |
338 delegate_->OnJobChanged(); | 341 delegate_->OnJobChanged(); |
339 } | 342 } |
340 | 343 |
| 344 protected: |
| 345 virtual ~PrinterWatcherWin() {} |
| 346 |
341 private: | 347 private: |
342 std::string printer_name_; | 348 std::string printer_name_; |
343 PrintSystem::PrinterWatcher::Delegate* delegate_; | 349 PrintSystem::PrinterWatcher::Delegate* delegate_; |
344 PrintSystemWatcherWin watcher_; | 350 PrintSystemWatcherWin watcher_; |
345 | 351 |
346 DISALLOW_COPY_AND_ASSIGN(PrinterWatcherWin); | 352 DISALLOW_COPY_AND_ASSIGN(PrinterWatcherWin); |
347 }; | 353 }; |
348 | 354 |
349 class JobSpoolerWin : public PrintSystem::JobSpooler { | 355 class JobSpoolerWin : public PrintSystem::JobSpooler { |
350 public: | 356 public: |
(...skipping 10 matching lines...) Expand all Loading... |
361 // TODO(gene): add tags handling. | 367 // TODO(gene): add tags handling. |
362 scoped_refptr<printing::PrintBackend> print_backend( | 368 scoped_refptr<printing::PrintBackend> print_backend( |
363 printing::PrintBackend::CreateInstance(NULL)); | 369 printing::PrintBackend::CreateInstance(NULL)); |
364 child_process_logging::ScopedPrinterInfoSetter prn_info( | 370 child_process_logging::ScopedPrinterInfoSetter prn_info( |
365 print_backend->GetPrinterDriverInfo(printer_name)); | 371 print_backend->GetPrinterDriverInfo(printer_name)); |
366 return core_->Spool(print_ticket, print_data_file_path, | 372 return core_->Spool(print_ticket, print_data_file_path, |
367 print_data_mime_type, printer_name, job_title, | 373 print_data_mime_type, printer_name, job_title, |
368 delegate); | 374 delegate); |
369 } | 375 } |
370 | 376 |
| 377 protected: |
| 378 virtual ~JobSpoolerWin() {} |
| 379 |
371 private: | 380 private: |
372 // We use a Core class because we want a separate RefCountedThreadSafe | 381 // We use a Core class because we want a separate RefCountedThreadSafe |
373 // implementation for ServiceUtilityProcessHost::Client. | 382 // implementation for ServiceUtilityProcessHost::Client. |
374 class Core : public ServiceUtilityProcessHost::Client, | 383 class Core : public ServiceUtilityProcessHost::Client, |
375 public base::win::ObjectWatcher::Delegate { | 384 public base::win::ObjectWatcher::Delegate { |
376 public: | 385 public: |
377 Core() | 386 Core() |
378 : last_page_printed_(-1), | 387 : last_page_printed_(-1), |
379 job_id_(-1), | 388 job_id_(-1), |
380 delegate_(NULL), | 389 delegate_(NULL), |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); | 898 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); |
890 return ret; | 899 return ret; |
891 } | 900 } |
892 | 901 |
893 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 902 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
894 const base::DictionaryValue* print_system_settings) { | 903 const base::DictionaryValue* print_system_settings) { |
895 return new PrintSystemWin; | 904 return new PrintSystemWin; |
896 } | 905 } |
897 | 906 |
898 } // namespace cloud_print | 907 } // namespace cloud_print |
OLD | NEW |