diff options
author | chenyu@chromium.org <chenyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-03 08:34:46 +0000 |
---|---|---|
committer | chenyu@chromium.org <chenyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-03 08:34:46 +0000 |
commit | 3eadbf2ed5b0f9599fd06f306ec98671097d9a34 (patch) | |
tree | d8a82dbc86ab5e757c1c12c792c08d943011ea79 /chrome/service/cloud_print/printer_job_handler.h | |
parent | 4a8c5381f864951926633fd0f2d235ad66e18b9e (diff) | |
download | chromium_src-3eadbf2ed5b0f9599fd06f306ec98671097d9a34.zip chromium_src-3eadbf2ed5b0f9599fd06f306ec98671097d9a34.tar.gz chromium_src-3eadbf2ed5b0f9599fd06f306ec98671097d9a34.tar.bz2 |
Move common cloud print code from service/cloud_print to common/cloud_print.
Sharable constants and methods are moved to common/cloud_print so they can be shared by all cloud print related features. Classes/constants/methods in service/cloud_print are moved into namespace cloud_print. Tests are added.
BUG=163603
Review URL: https://chromiumcodereview.appspot.com/11360151
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/cloud_print/printer_job_handler.h')
-rw-r--r-- | chrome/service/cloud_print/printer_job_handler.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/chrome/service/cloud_print/printer_job_handler.h b/chrome/service/cloud_print/printer_job_handler.h index 7ee440c..9090ca3 100644 --- a/chrome/service/cloud_print/printer_job_handler.h +++ b/chrome/service/cloud_print/printer_job_handler.h @@ -61,11 +61,13 @@ class URLFetcher; // Stop // (If there are pending tasks go back to Start) +namespace cloud_print { + class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, public CloudPrintURLFetcherDelegate, public JobStatusUpdaterDelegate, - public cloud_print::PrinterWatcherDelegate, - public cloud_print::JobSpoolerDelegate { + public PrinterWatcherDelegate, + public JobSpoolerDelegate { public: class Delegate { public: @@ -88,7 +90,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, PrinterJobHandler(const printing::PrinterBasicInfo& printer_info, const PrinterInfoFromCloud& printer_info_from_server, const GURL& cloud_print_server_url, - cloud_print::PrintSystem* print_system, + PrintSystem* print_system, Delegate* delegate); bool Initialize(); @@ -132,15 +134,14 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, virtual bool OnJobCompleted(JobStatusUpdater* updater) OVERRIDE; virtual void OnAuthError() OVERRIDE; - // cloud_print::PrinterWatcherDelegate implementation + // PrinterWatcherDelegate implementation virtual void OnPrinterDeleted() OVERRIDE; virtual void OnPrinterChanged() OVERRIDE; virtual void OnJobChanged() OVERRIDE; - // cloud_print::JobSpoolerDelegate implementation. + // JobSpoolerDelegate implementation. // Called on print_thread_. - virtual void OnJobSpoolSucceeded( - const cloud_print::PlatformJobId& job_id) OVERRIDE; + virtual void OnJobSpoolSucceeded(const PlatformJobId& job_id) OVERRIDE; virtual void OnJobSpoolFailed() OVERRIDE; // End Delegate implementations @@ -229,7 +230,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, void StartPrinting(); void Reset(); - void UpdateJobStatus(cloud_print::PrintJobStatus status, PrintJobError error); + void UpdateJobStatus(PrintJobStatus status, PrintJobError error); // Sets the next response handler to the specifed JSON data handler. void SetNextJSONHandler(JSONDataHandler handler); @@ -237,7 +238,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, void SetNextDataHandler(DataHandler handler); void JobFailed(PrintJobError error); - void JobSpooled(cloud_print::PlatformJobId local_job_id); + void JobSpooled(PlatformJobId local_job_id); // Returns false if printer info is up to date and no updating is needed. bool UpdatePrinterInfo(); bool HavePendingTasks(); @@ -254,7 +255,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, const std::string& printer_name); scoped_refptr<CloudPrintURLFetcher> request_; - scoped_refptr<cloud_print::PrintSystem> print_system_; + scoped_refptr<PrintSystem> print_system_; printing::PrinterBasicInfo printer_info_; PrinterInfoFromCloud printer_info_cloud_; GURL cloud_print_server_url_; @@ -263,7 +264,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, Delegate* delegate_; // Once the job has been spooled to the local spooler, this specifies the // job id of the job on the local spooler. - cloud_print::PlatformJobId local_job_id_; + PlatformJobId local_job_id_; // The next response handler can either be a JSONDataHandler or a // DataHandler (depending on the current request being made). @@ -275,7 +276,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, base::Thread print_thread_; // The Job spooler object. This is only non-NULL during a print operation. // It lives and dies on |print_thread_| - scoped_refptr<cloud_print::PrintSystem::JobSpooler> job_spooler_; + scoped_refptr<PrintSystem::JobSpooler> job_spooler_; // The message loop proxy representing the thread on which this object // was created. Used by the print thread. scoped_refptr<base::MessageLoopProxy> job_handler_message_loop_proxy_; @@ -293,7 +294,7 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, // Some task in the state machine is in progress. bool task_in_progress_; - scoped_refptr<cloud_print::PrintSystem::PrinterWatcher> printer_watcher_; + scoped_refptr<PrintSystem::PrinterWatcher> printer_watcher_; typedef std::list< scoped_refptr<JobStatusUpdater> > JobStatusUpdaterList; JobStatusUpdaterList job_status_updater_list_; @@ -309,4 +310,6 @@ class PrinterJobHandler : public base::RefCountedThreadSafe<PrinterJobHandler>, // the workaround was not needed for my machine). typedef PrinterJobHandler::Delegate PrinterJobHandlerDelegate; +} // namespace cloud_print + #endif // CHROME_SERVICE_CLOUD_PRINT_PRINTER_JOB_HANDLER_H_ |