OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Schedule the CUPS query off the UI thread. Posts results back to UI thread | 60 // Schedule the CUPS query off the UI thread. Posts results back to UI thread |
61 // to UpdateJobs. | 61 // to UpdateJobs. |
62 void PostQuery(); | 62 void PostQuery(); |
63 | 63 |
64 // Process jobs from CUPS and perform notifications. | 64 // Process jobs from CUPS and perform notifications. |
65 void UpdateJobs(const QueryResult& results); | 65 void UpdateJobs(const QueryResult& results); |
66 | 66 |
67 // Mark remaining jobs as errors and remove active jobs. | 67 // Mark remaining jobs as errors and remove active jobs. |
68 void PurgeJobs(); | 68 void PurgeJobs(); |
69 | 69 |
70 // Updates the state and performs the appropriate notifications. | 70 // Notify observers that a state update has occured for |job|. |
71 void JobStateUpdated(CupsPrintJob* job, CupsPrintJob::State new_state); | 71 void NotifyJobStateUpdate(CupsPrintJob* job); |
72 | 72 |
73 // Ongoing print jobs. | 73 // Ongoing print jobs. |
74 std::map<std::string, std::unique_ptr<CupsPrintJob>> jobs_; | 74 std::map<std::string, std::unique_ptr<CupsPrintJob>> jobs_; |
75 | 75 |
76 // Prevents multiple queries from being scheduled simultaneously. | 76 // Prevents multiple queries from being scheduled simultaneously. |
77 bool in_query_ = false; | 77 bool in_query_ = false; |
78 | 78 |
79 // Records the number of consecutive times the GetJobs query has failed. | 79 // Records the number of consecutive times the GetJobs query has failed. |
80 int retry_count_ = 0; | 80 int retry_count_ = 0; |
81 | 81 |
82 ::printing::CupsConnection cups_connection_; | 82 ::printing::CupsConnection cups_connection_; |
83 content::NotificationRegistrar registrar_; | 83 content::NotificationRegistrar registrar_; |
84 base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_; | 84 base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(CupsPrintJobManagerImpl); | 86 DISALLOW_COPY_AND_ASSIGN(CupsPrintJobManagerImpl); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace chromeos | 89 } // namespace chromeos |
90 | 90 |
91 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ | 91 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ |
OLD | NEW |