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

Unified Diff: printing/backend/cups_connection.h

Issue 2691093006: Implement IPP Get-Jobs and Get-Printer-Attributes requests. (Closed)
Patch Set: assign default values to id and state 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 side-by-side diff with in-line comments
Download patch
Index: printing/backend/cups_connection.h
diff --git a/printing/backend/cups_connection.h b/printing/backend/cups_connection.h
index fe8a7a23f90e87e993f70964912bfcbdb9ed089b..a3f6dd5e0c427d15f6a2e157341d3bd40ab0d039 100644
--- a/printing/backend/cups_connection.h
+++ b/printing/backend/cups_connection.h
@@ -14,29 +14,20 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "printing/backend/cups_deleters.h"
+#include "printing/backend/cups_jobs.h"
#include "printing/backend/cups_printer.h"
#include "printing/printing_export.h"
#include "url/gurl.h"
namespace printing {
-// Represents a print job sent to the queue.
-struct PRINTING_EXPORT CupsJob {
- enum JobState {
- UNKNOWN,
- PENDING,
- HELD,
- COMPLETED,
- PROCESSING,
- STOPPED,
- CANCELED,
- ABORTED
- };
-
- int id;
- std::string title;
- std::string printer_id;
- JobState state;
+// Represents the status of a printer queue.
+struct PRINTING_EXPORT QueueStatus {
+ QueueStatus(PrinterStatus status, std::vector<CupsJob> cups_jobs)
Carlson 2017/02/24 00:02:08 I suspect the second argument here should be a con
skau 2017/02/28 00:59:58 I've removed the constructor and I'm populating th
+ : printer_status(status), jobs(cups_jobs) {}
+
+ PrinterStatus printer_status;
+ std::vector<CupsJob> jobs;
};
// Represents a connection to a CUPS server.
@@ -56,8 +47,11 @@ class PRINTING_EXPORT CupsConnection {
// Returns a printer for |printer_name| from the connected server.
std::unique_ptr<CupsPrinter> GetPrinter(const std::string& printer_name);
- // Returns a list of print jobs from all connected printers.
- std::vector<CupsJob> GetJobs();
+ // Queries CUPS for printer queue status for |printer_ids|. Populates |jobs|
+ // with said information with one QueueStatus per printer_id. Returns true if
+ // all the queries were successful.
Carlson 2017/02/24 00:02:08 What can we expect about |jobs| if not all the que
skau 2017/02/28 00:59:58 Done.
+ bool GetJobs(const std::vector<std::string>& printer_ids,
+ std::vector<QueueStatus>* jobs);
std::string server_name() const;

Powered by Google App Engine
This is Rietveld 408576698