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

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

Issue 2699273002: Use job id from JobEventDetails to create CupsPrintJobs. (Closed)
Patch Set: add rate limiting Created 3 years, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 // NotificationObserver overrides: 37 // NotificationObserver overrides:
38 void Observe(int type, 38 void Observe(int type,
39 const content::NotificationSource& source, 39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) override; 40 const content::NotificationDetails& details) override;
41 41
42 private: 42 private:
43 // Begin monitoring a print job for a given |printer_name| with the given 43 // Begin monitoring a print job for a given |printer_name| with the given
44 // |title| with the pages |total_page_number|. 44 // |title| with the pages |total_page_number|.
45 bool CreatePrintJob(const std::string& printer_name, 45 bool CreatePrintJob(const std::string& printer_name,
46 const std::string& title, 46 const std::string& title,
47 int job_id,
47 int total_page_number); 48 int total_page_number);
48 49
49 // Schedule a query of CUPS for print job status. 50 // Schedule a query of CUPS for print job status with the default delay.
50 void ScheduleQuery(); 51 void ScheduleQuery();
52 // Schedule a query of CUPS for print job status with a delay of |delay|.
53 void ScheduleQuery(const base::TimeDelta& delay);
51 54
52 // Query CUPS for print job status. 55 // Query CUPS for print job status.
53 void QueryCups(); 56 void QueryCups();
54 57
55 // Process jobs from CUPS and perform notifications. 58 // Process jobs from CUPS and perform notifications.
56 void UpdateJobs(const std::vector<::printing::CupsJob>& jobs); 59 void UpdateJobs(const std::vector<::printing::CupsJob>& jobs);
57 60
58 // Updates the state and performs the appropriate notifications. 61 // Updates the state and performs the appropriate notifications.
59 void JobStateUpdated(CupsPrintJob* job, CupsPrintJob::State new_state); 62 void JobStateUpdated(CupsPrintJob* job, CupsPrintJob::State new_state);
60 63
61 // Ongoing print jobs. 64 // Ongoing print jobs.
62 std::map<std::string, std::unique_ptr<CupsPrintJob>> jobs_; 65 std::map<std::string, std::unique_ptr<CupsPrintJob>> jobs_;
63 66
67 // Prevents multiple queries from being scheduled simultaneously.
68 bool in_query_ = false;
69
64 ::printing::CupsConnection cups_connection_; 70 ::printing::CupsConnection cups_connection_;
65 content::NotificationRegistrar registrar_; 71 content::NotificationRegistrar registrar_;
66 base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_; 72 base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_;
67 73
68 DISALLOW_COPY_AND_ASSIGN(CupsPrintJobManagerImpl); 74 DISALLOW_COPY_AND_ASSIGN(CupsPrintJobManagerImpl);
69 }; 75 };
70 76
71 } // namespace chromeos 77 } // namespace chromeos
72 78
73 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_ 79 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_CUPS_PRINT_JOB_MANAGER_IMPL_H_
OLDNEW
« 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