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

Unified Diff: printing/backend/cups_jobs.h

Issue 2891643002: Add a method to query IPP printers for attributes. (Closed)
Patch Set: check empty Created 3 years, 6 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 | « chrome/browser/chromeos/printing/printer_info_stub.cc ('k') | printing/backend/cups_jobs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/cups_jobs.h
diff --git a/printing/backend/cups_jobs.h b/printing/backend/cups_jobs.h
index b1ca693c82858288fdf01ebffc2f41eda426e141..8c0e4d4b703d8d2ee3fb5b5d44531fe15251ef32 100644
--- a/printing/backend/cups_jobs.h
+++ b/printing/backend/cups_jobs.h
@@ -10,10 +10,16 @@
#include <cups/cups.h>
#include <string>
+#include <utility>
#include <vector>
+#include "base/version.h"
#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 +116,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 supported IPP protocol versions.
+ std::vector<base::Version> 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 +152,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
+// 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.
« no previous file with comments | « chrome/browser/chromeos/printing/printer_info_stub.cc ('k') | printing/backend/cups_jobs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698