OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ |
6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ | 6 #define CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ |
7 | 7 |
| 8 #include <set> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
14 #include "printing/print_destination_interface.h" | 15 #include "printing/print_destination_interface.h" |
15 | 16 |
16 namespace printing { | 17 namespace printing { |
17 | 18 |
(...skipping 27 matching lines...) Expand all Loading... |
45 | 46 |
46 // content::NotificationObserver | 47 // content::NotificationObserver |
47 virtual void Observe(int type, | 48 virtual void Observe(int type, |
48 const content::NotificationSource& source, | 49 const content::NotificationSource& source, |
49 const content::NotificationDetails& details) OVERRIDE; | 50 const content::NotificationDetails& details) OVERRIDE; |
50 | 51 |
51 // May return NULL when no destination was set. | 52 // May return NULL when no destination was set. |
52 PrintDestinationInterface* destination() const { return destination_.get(); } | 53 PrintDestinationInterface* destination() const { return destination_.get(); } |
53 | 54 |
54 private: | 55 private: |
55 typedef std::vector<scoped_refptr<PrintJob> > PrintJobs; | 56 typedef std::set<scoped_refptr<PrintJob> > PrintJobs; |
56 typedef std::vector<scoped_refptr<PrinterQuery> > PrinterQueries; | 57 typedef std::vector<scoped_refptr<PrinterQuery> > PrinterQueries; |
57 | 58 |
58 // Processes a NOTIFY_PRINT_JOB_EVENT notification. | 59 // Processes a NOTIFY_PRINT_JOB_EVENT notification. |
59 void OnPrintJobEvent(PrintJob* print_job, | 60 void OnPrintJobEvent(PrintJob* print_job, |
60 const JobEventDetails& event_details); | 61 const JobEventDetails& event_details); |
61 | 62 |
62 content::NotificationRegistrar registrar_; | 63 content::NotificationRegistrar registrar_; |
63 | 64 |
64 // Used to serialize access to queued_workers_. | 65 // Used to serialize access to queued_workers_. |
65 base::Lock lock_; | 66 base::Lock lock_; |
66 | 67 |
67 PrinterQueries queued_queries_; | 68 PrinterQueries queued_queries_; |
68 | 69 |
69 scoped_refptr<PrintDestinationInterface> destination_; | 70 scoped_refptr<PrintDestinationInterface> destination_; |
70 | 71 |
71 // Current print jobs that are active. | 72 // Current print jobs that are active. |
72 PrintJobs current_jobs_; | 73 PrintJobs current_jobs_; |
73 | 74 |
74 DISALLOW_COPY_AND_ASSIGN(PrintJobManager); | 75 DISALLOW_COPY_AND_ASSIGN(PrintJobManager); |
75 }; | 76 }; |
76 | 77 |
77 } // namespace printing | 78 } // namespace printing |
78 | 79 |
79 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ | 80 #endif // CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_ |
OLD | NEW |