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..906f65144970dc4cec4fccff6ee47f5e80228acf |
| --- /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 { |
| + 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; |
|
skau
2016/10/27 01:43:00
Should we change this to CupsPrintJob#UniqueId?
xdai1
2016/10/28 23:59:53
Why? Actually since |job| is owned by CupsPrintJob
skau
2016/10/31 15:39:05
It's not obvious that this method will delete the
|
| + virtual bool SuspendPrintJob(CupsPrintJob* job) = 0; |
| + virtual bool ResumePrintJob(CupsPrintJob* job) = 0; |
| + |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| + 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_ |