summaryrefslogtreecommitdiffstats
path: root/chrome/service/cloud_print/print_system.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/service/cloud_print/print_system.h')
-rw-r--r--chrome/service/cloud_print/print_system.h75
1 files changed, 46 insertions, 29 deletions
diff --git a/chrome/service/cloud_print/print_system.h b/chrome/service/cloud_print/print_system.h
index b7d0ce5..1d83a87 100644
--- a/chrome/service/cloud_print/print_system.h
+++ b/chrome/service/cloud_print/print_system.h
@@ -81,35 +81,6 @@ struct PrintJobDetails {
// functionality on some platforms, while reusing core (CUPS) functions.
class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> {
public:
- virtual ~PrintSystem() {}
-
- // Enumerates the list of installed local and network printers.
- virtual void EnumeratePrinters(PrinterList* printer_list) = 0;
-
- // Gets the capabilities and defaults for a specific printer.
- virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name,
- PrinterCapsAndDefaults* printer_info) = 0;
-
- // Returns true if ticket is valid.
- virtual bool ValidatePrintTicket(const std::string& printer_name,
- const std::string& print_ticket_data) = 0;
-
- // Send job to the printer.
- virtual bool SpoolPrintJob(const std::string& print_ticket,
- const FilePath& print_data_file_path,
- const std::string& print_data_mime_type,
- const std::string& printer_name,
- const std::string& job_title,
- PlatformJobId* job_id_ret) = 0;
-
- // Get details for already spooled job.
- virtual bool GetJobDetails(const std::string& printer_name,
- PlatformJobId job_id,
- PrintJobDetails *job_details) = 0;
-
- // Returns true if printer_name points to a valid printer.
- virtual bool IsValidPrinter(const std::string& printer_name) = 0;
-
class PrintServerWatcher
: public base::RefCountedThreadSafe<PrintServerWatcher> {
public:
@@ -141,11 +112,56 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> {
virtual bool GetCurrentPrinterInfo(PrinterBasicInfo* printer_info) = 0;
};
+ class JobSpooler : public base::RefCountedThreadSafe<JobSpooler> {
+ public:
+ // Callback interface for JobSpooler notifications.
+ class Delegate {
+ public:
+ virtual ~Delegate() { }
+ virtual void OnJobSpoolSucceeded(const PlatformJobId& job_id) = 0;
+ virtual void OnJobSpoolFailed() = 0;
+ };
+
+ 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
+ // or Delegate::OnJobSpoolFailed methods are called) can fail.
+ virtual bool Spool(const std::string& print_ticket,
+ const FilePath& print_data_file_path,
+ const std::string& print_data_mime_type,
+ const std::string& printer_name,
+ const std::string& job_title,
+ JobSpooler::Delegate* delegate) = 0;
+ };
+
+ virtual ~PrintSystem() {}
+
+ // Enumerates the list of installed local and network printers.
+ virtual void EnumeratePrinters(PrinterList* printer_list) = 0;
+
+ // Gets the capabilities and defaults for a specific printer.
+ virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name,
+ PrinterCapsAndDefaults* printer_info) = 0;
+
+ // Returns true if ticket is valid.
+ virtual bool ValidatePrintTicket(const std::string& printer_name,
+ const std::string& print_ticket_data) = 0;
+
+ // Get details for already spooled job.
+ virtual bool GetJobDetails(const std::string& printer_name,
+ PlatformJobId job_id,
+ PrintJobDetails *job_details) = 0;
+
+ // Returns true if printer_name points to a valid printer.
+ virtual bool IsValidPrinter(const std::string& printer_name) = 0;
+
// Factory methods to create corresponding watcher. Callee is responsible
// for deleting objects. Return NULL if failed.
virtual PrintServerWatcher* CreatePrintServerWatcher() = 0;
virtual PrinterWatcher* CreatePrinterWatcher(
const std::string& printer_name) = 0;
+ virtual JobSpooler* CreateJobSpooler() = 0;
// Generate unique for proxy.
static std::string GenerateProxyId();
@@ -164,6 +180,7 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> {
// the workaround was not needed for my machine).
typedef PrintSystem::PrintServerWatcher::Delegate PrintServerWatcherDelegate;
typedef PrintSystem::PrinterWatcher::Delegate PrinterWatcherDelegate;
+typedef PrintSystem::JobSpooler::Delegate JobSpoolerDelegate;
} // namespace cloud_print