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 { | |
| 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; | |
|
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
| |
| 56 virtual bool SuspendPrintJob(CupsPrintJob* job) = 0; | |
| 57 virtual bool ResumePrintJob(CupsPrintJob* job) = 0; | |
| 58 | |
| 59 void AddObserver(Observer* observer); | |
| 60 void RemoveObserver(Observer* observer); | |
| 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 |