Chromium Code Reviews| 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. |