| 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 // Cancel a print job |job|. Note the |job| will be deleted after cancelled. |
| 56 virtual bool CancelPrintJob(CupsPrintJob* job) = 0; |
| 57 virtual bool SuspendPrintJob(CupsPrintJob* job) = 0; |
| 58 virtual bool ResumePrintJob(CupsPrintJob* job) = 0; |
| 59 |
| 60 void AddObserver(Observer* observer); |
| 61 void RemoveObserver(Observer* observer); |
| 62 |
| 63 protected: |
| 64 PrintJobs print_jobs_; |
| 65 Profile* profile_; |
| 66 std::unique_ptr<CupsPrintJobNotificationManager> notification_manager_; |
| 67 std::vector<Observer*> observers_; |
| 68 |
| 69 private: |
| 70 DISALLOW_COPY_AND_ASSIGN(CupsPrintJobManager); |
| 71 }; |
| 72 |
| 73 } // namespace chromeos |
| 74 |
| 75 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_H_ |
| OLD | NEW |