Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/chromeos/printing/cups_print_job_manager.h

Issue 2435303003: [CUPS] Implement the Print Job notification. (Closed)
Patch Set: Fix the compile warning. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/printing/cups_print_job.cc ('k') | chrome/browser/chromeos/printing/cups_print_job_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698