diff options
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/print_system.cc | 36 | ||||
-rw-r--r-- | chrome/service/cloud_print/print_system.h | 40 |
2 files changed, 54 insertions, 22 deletions
diff --git a/chrome/service/cloud_print/print_system.cc b/chrome/service/cloud_print/print_system.cc new file mode 100644 index 0000000..57c1342 --- /dev/null +++ b/chrome/service/cloud_print/print_system.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/service/cloud_print/print_system.h" + +namespace cloud_print { + +PrinterBasicInfo::PrinterBasicInfo() : printer_status(0) {} + +PrinterBasicInfo::~PrinterBasicInfo() {} + +PrintJobDetails::PrintJobDetails() + : status(PRINT_JOB_STATUS_INVALID), + platform_status_flags(0), + total_pages(0), + pages_printed(0) { +} + +void PrintJobDetails::Clear() { + status = PRINT_JOB_STATUS_INVALID; + platform_status_flags = 0; + status_message.clear(); + total_pages = 0; + pages_printed = 0; +} + +PrintSystem::PrintServerWatcher::~PrintServerWatcher() {} + +PrintSystem::PrinterWatcher::~PrinterWatcher() {} + +PrintSystem::JobSpooler::~JobSpooler() {} + +PrintSystem::~PrintSystem() {} + +} // namespace cloud_print diff --git a/chrome/service/cloud_print/print_system.h b/chrome/service/cloud_print/print_system.h index b0e287d..2abdcc3 100644 --- a/chrome/service/cloud_print/print_system.h +++ b/chrome/service/cloud_print/print_system.h @@ -21,12 +21,13 @@ namespace cloud_print { typedef int PlatformJobId; struct PrinterBasicInfo { + PrinterBasicInfo(); + ~PrinterBasicInfo(); + std::string printer_name; std::string printer_description; int printer_status; std::map<std::string, std::string> options; - PrinterBasicInfo() : printer_status(0) { - } }; typedef std::vector<PrinterBasicInfo> PrinterList; @@ -46,22 +47,10 @@ enum PrintJobStatus { }; struct PrintJobDetails { - PrintJobStatus status; - int platform_status_flags; - std::string status_message; - int total_pages; - int pages_printed; - PrintJobDetails() : status(PRINT_JOB_STATUS_INVALID), - platform_status_flags(0), total_pages(0), - pages_printed(0) { - } - void Clear() { - status = PRINT_JOB_STATUS_INVALID; - platform_status_flags = 0; - status_message.clear(); - total_pages = 0; - pages_printed = 0; - } + PrintJobDetails(); + + void Clear(); + bool operator ==(const PrintJobDetails& other) const { return (status == other.status) && (platform_status_flags == other.platform_status_flags) && @@ -69,9 +58,16 @@ struct PrintJobDetails { (total_pages == other.total_pages) && (pages_printed == other.pages_printed); } + bool operator !=(const PrintJobDetails& other) const { return !(*this == other); } + + PrintJobStatus status; + int platform_status_flags; + std::string status_message; + int total_pages; + int pages_printed; }; // PrintSystem class will provide interface for different printing systems @@ -96,7 +92,7 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> { virtual ~Delegate() {} }; - virtual ~PrintServerWatcher() {} + virtual ~PrintServerWatcher(); virtual bool StartWatching(PrintServerWatcher::Delegate* delegate) = 0; virtual bool StopWatching() = 0; }; @@ -114,7 +110,7 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> { virtual ~Delegate() {} }; - virtual ~PrinterWatcher() {} + virtual ~PrinterWatcher(); virtual bool StartWatching(PrinterWatcher::Delegate* delegate) = 0; virtual bool StopWatching() = 0; virtual bool GetCurrentPrinterInfo(PrinterBasicInfo* printer_info) = 0; @@ -130,7 +126,7 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> { virtual void OnJobSpoolFailed() = 0; }; - virtual ~JobSpooler() {} + virtual ~JobSpooler(); // Spool job to the printer asynchronously. Caller will be notified via // |delegate|. Note that only one print job can be in progress at any given // time. Subsequent calls to Spool (before the Delegate::OnJobSpoolSucceeded @@ -143,7 +139,7 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> { JobSpooler::Delegate* delegate) = 0; }; - virtual ~PrintSystem() {} + virtual ~PrintSystem(); // Enumerates the list of installed local and network printers. virtual void EnumeratePrinters(PrinterList* printer_list) = 0; |