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

Unified Diff: printing/backend/cups_jobs.h

Issue 2891643002: Add a method to query IPP printers for attributes. (Closed)
Patch Set: add thread assertions Created 3 years, 7 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_jobs.h
diff --git a/printing/backend/cups_jobs.h b/printing/backend/cups_jobs.h
index b1ca693c82858288fdf01ebffc2f41eda426e141..b6e5b116b1f9311a2b00401d7fe1be03fdb57188 100644
--- a/printing/backend/cups_jobs.h
+++ b/printing/backend/cups_jobs.h
@@ -10,10 +10,15 @@
#include <cups/cups.h>
#include <string>
+#include <utility>
#include <vector>
#include "printing/printing_export.h"
+// This file contains a collection of functions used to query IPP printers or
+// print servers and the related code to parse these responses. All Get*
+// operations block on the network request and cannot be run on the UI thread.
+
namespace printing {
// Represents a print job sent to the queue.
@@ -110,6 +115,27 @@ struct PRINTING_EXPORT PrinterStatus {
std::string message;
};
+struct PRINTING_EXPORT PrinterInfo {
+ PrinterInfo();
+ PrinterInfo(const PrinterInfo& info);
+
+ ~PrinterInfo();
+
+ // printer-make-and-model
+ std::string make_and_model;
+
+ // document-format-supported
+ // MIME types for supported formats.
+ std::vector<std::string> document_formats;
+
+ // ipp-versions-supported
+ // A collection of major, minor pairs.
+ std::vector<std::pair<int, int>> ipp_versions;
+
+ // Does ipp-features-supported contain 'ipp-everywhere'.
+ bool ipp_everywhere = false;
+};
+
// Specifies classes of jobs.
enum JobCompletionState {
COMPLETED, // only completed jobs
@@ -125,6 +151,13 @@ void ParseJobsResponse(ipp_t* response,
// Attempts to extract a PrinterStatus object out of |response|.
void ParsePrinterStatus(ipp_t* response, PrinterStatus* printer_status);
+// Queries the printer at |address| on |port| with a Get-Printer-Attributes
Lei Zhang 2017/05/31 00:48:03 Curious why this take [address, port] rather than
skau 2017/05/31 18:37:51 The other functions can reuse http_t since they're
+// request to populate |printer_info|. Returns false if the request failed.
+bool PRINTING_EXPORT GetPrinterInfo(const std::string& address,
+ const int port,
+ const std::string& resource,
+ PrinterInfo* printer_info);
+
// Attempts to retrieve printer status using connection |http| for |printer_id|.
// Returns true if succcssful and updates the fields in |printer_status| as
// appropriate. Returns false if the request failed.

Powered by Google App Engine
This is Rietveld 408576698