Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "chrome/browser/chromeos/printing/cups_print_job.h" | |
| 11 #include "components/keyed_service/core/keyed_service.h" | |
| 12 | |
| 13 class Profile; | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserContext; | |
| 17 } | |
| 18 | |
| 19 namespace chromeos { | |
| 20 | |
| 21 class CUPSPrintJobNotificationManager; | |
| 22 | |
| 23 class CUPSPrintJobManager : public KeyedService { | |
|
stevenjb
2016/10/26 19:59:58
CupsProntJobManager
xdai1
2016/10/26 22:55:19
Done.
| |
| 24 public: | |
| 25 class Observer { | |
| 26 public: | |
| 27 virtual void OnPrintJobCreated(CUPSPrintJob* job) {} | |
| 28 virtual void OnPrintJobStarted(CUPSPrintJob* job) {} | |
| 29 virtual void OnPrintJobUpdated(CUPSPrintJob* job) {} | |
| 30 virtual void OnPrintJobSuspended(CUPSPrintJob* job) {} | |
| 31 virtual void OnPrintJobResumed(CUPSPrintJob* job) {} | |
| 32 virtual void OnPrintJobDone(CUPSPrintJob* job) {} | |
| 33 virtual void OnPrintJobError(CUPSPrintJob* job) {} | |
| 34 virtual void OnPrintJobCancelled(int job_id) {} | |
| 35 | |
| 36 protected: | |
| 37 virtual ~Observer() {} | |
| 38 }; | |
| 39 | |
| 40 using PrintJobs = std::vector<std::unique_ptr<CUPSPrintJob>>; | |
| 41 | |
| 42 explicit CUPSPrintJobManager(Profile* profile); | |
| 43 ~CUPSPrintJobManager() override; | |
| 44 | |
| 45 // KeyedService override: | |
| 46 void Shutdown() override; | |
| 47 | |
| 48 // Returns the CUPSPrintJobManager instance that associated with the current | |
| 49 // profile. | |
| 50 static CUPSPrintJobManager* Get(content::BrowserContext* browser_context); | |
| 51 | |
| 52 virtual bool CreatePrintJob(const std::string& printer_name, | |
| 53 const std::string& title, | |
| 54 int total_page_number) = 0; | |
| 55 virtual bool CancelPrintJob(CUPSPrintJob* job) = 0; | |
| 56 virtual bool SuspendPrintJob(CUPSPrintJob* job) = 0; | |
| 57 virtual bool ResumePrintJob(CUPSPrintJob* job) = 0; | |
| 58 | |
| 59 virtual void AddObserver(Observer* observer); | |
| 60 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.
| |
| 61 | |
| 62 protected: | |
| 63 PrintJobs print_jobs_; | |
| 64 Profile* profile_; | |
| 65 std::unique_ptr<CUPSPrintJobNotificationManager> notification_manager_; | |
| 66 std::vector<Observer*> observers_; | |
| 67 | |
| 68 private: | |
| 69 DISALLOW_COPY_AND_ASSIGN(CUPSPrintJobManager); | |
| 70 }; | |
| 71 | |
| 72 } // namespace chromeos | |
| 73 | |
| 74 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ | |
| OLD | NEW |