Chromium Code Reviews| Index: chrome/browser/chromeos/printing/cups_print_job_manager.h |
| diff --git a/chrome/browser/chromeos/printing/cups_print_job_manager.h b/chrome/browser/chromeos/printing/cups_print_job_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2976a2c6f0e7f73e339ea43c455b74f614f90051 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/printing/cups_print_job_manager.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "chrome/browser/chromeos/printing/cups_print_job.h" |
| +#include "components/keyed_service/core/keyed_service.h" |
| + |
| +class Profile; |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace chromeos { |
| + |
| +class CUPSPrintJobNotificationManager; |
| + |
| +class CUPSPrintJobManager : public KeyedService { |
|
stevenjb
2016/10/26 19:59:58
CupsProntJobManager
xdai1
2016/10/26 22:55:19
Done.
|
| + public: |
| + class Observer { |
| + public: |
| + virtual void OnPrintJobCreated(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobStarted(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobUpdated(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobSuspended(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobResumed(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobDone(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobError(CUPSPrintJob* job) {} |
| + virtual void OnPrintJobCancelled(int job_id) {} |
| + |
| + protected: |
| + virtual ~Observer() {} |
| + }; |
| + |
| + using PrintJobs = std::vector<std::unique_ptr<CUPSPrintJob>>; |
| + |
| + explicit CUPSPrintJobManager(Profile* profile); |
| + ~CUPSPrintJobManager() override; |
| + |
| + // KeyedService override: |
| + void Shutdown() override; |
| + |
| + // Returns the CUPSPrintJobManager instance that associated with the current |
| + // profile. |
| + static CUPSPrintJobManager* Get(content::BrowserContext* browser_context); |
| + |
| + virtual bool CreatePrintJob(const std::string& printer_name, |
| + const std::string& title, |
| + int total_page_number) = 0; |
| + virtual bool CancelPrintJob(CUPSPrintJob* job) = 0; |
| + virtual bool SuspendPrintJob(CUPSPrintJob* job) = 0; |
| + virtual bool ResumePrintJob(CUPSPrintJob* job) = 0; |
| + |
| + virtual void AddObserver(Observer* observer); |
| + virtual void RemoveObserver(Observer* observer); |
|
stevenjb
2016/10/26 19:59:58
Do these need to be virtual?
xdai1
2016/10/26 22:55:19
Not necessary... Removed it. Thanks.
|
| + |
| + protected: |
| + PrintJobs print_jobs_; |
| + Profile* profile_; |
| + std::unique_ptr<CUPSPrintJobNotificationManager> notification_manager_; |
| + std::vector<Observer*> observers_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(CUPSPrintJobManager); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ |