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

Unified Diff: chrome/browser/chromeos/printing/cups_print_job_manager_impl.h

Issue 2691093006: Implement IPP Get-Jobs and Get-Printer-Attributes requests. (Closed)
Patch Set: use a const array Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/printing/cups_print_job_manager_impl.h
diff --git a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h
index afd64c901063fbc04acce7ef4e7731903616b7f5..d32066d6f8e3a6daea969c36ba5f715b487d2c30 100644
--- a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h
+++ b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h
@@ -23,6 +23,11 @@ class Profile;
namespace chromeos {
+struct QueryResult {
+ bool success;
+ std::vector<::printing::QueueStatus> queues;
+};
+
class CupsPrintJobManagerImpl : public CupsPrintJobManager,
public content::NotificationObserver {
public:
@@ -52,11 +57,15 @@ class CupsPrintJobManagerImpl : public CupsPrintJobManager,
// Schedule a query of CUPS for print job status with a delay of |delay|.
void ScheduleQuery(const base::TimeDelta& delay);
- // Query CUPS for print job status.
- void QueryCups();
+ // Schedule the CUPS query off the UI thread. Posts results back to UI thread
+ // to UpdateJobs.
+ void PostQuery();
// Process jobs from CUPS and perform notifications.
- void UpdateJobs(const std::vector<::printing::CupsJob>& jobs);
+ void UpdateJobs(const QueryResult& results);
+
+ // Mark remaining jobs as errors and remove active jobs.
+ void PurgeJobs();
// Updates the state and performs the appropriate notifications.
void JobStateUpdated(CupsPrintJob* job, CupsPrintJob::State new_state);
@@ -67,6 +76,9 @@ class CupsPrintJobManagerImpl : public CupsPrintJobManager,
// Prevents multiple queries from being scheduled simultaneously.
bool in_query_ = false;
+ // Records the number of consecutive times the GetJobs query has failed.
+ int retry_count_ = 0;
+
::printing::CupsConnection cups_connection_;
content::NotificationRegistrar registrar_;
base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698