OLD | NEW |
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 #include "printing/backend/cups_jobs.h" | 5 #include "printing/backend/cups_jobs.h" |
6 | 6 |
7 #include <cups/ipp.h> | 7 #include <cups/ipp.h> |
8 | 8 |
9 #include <array> | 9 #include <array> |
10 #include <map> | 10 #include <map> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const char kMarkerWasteFull[] = "marker-waste-full"; | 78 const char kMarkerWasteFull[] = "marker-waste-full"; |
79 const char kFuserOverTemp[] = "fuser-over-temp"; | 79 const char kFuserOverTemp[] = "fuser-over-temp"; |
80 const char kFuserUnderTemp[] = "fuser-under-temp"; | 80 const char kFuserUnderTemp[] = "fuser-under-temp"; |
81 const char kOpcNearEol[] = "opc-near-eol"; | 81 const char kOpcNearEol[] = "opc-near-eol"; |
82 const char kOpcLifeOver[] = "opc-life-over"; | 82 const char kOpcLifeOver[] = "opc-life-over"; |
83 const char kDeveloperLow[] = "developer-low"; | 83 const char kDeveloperLow[] = "developer-low"; |
84 const char kDeveloperEmpty[] = "developer-empty"; | 84 const char kDeveloperEmpty[] = "developer-empty"; |
85 const char kInterpreterResourceUnavailable[] = | 85 const char kInterpreterResourceUnavailable[] = |
86 "interpreter-resource-unavailable"; | 86 "interpreter-resource-unavailable"; |
87 | 87 |
88 constexpr std::array<const char* const, 3> kPrinterAttributes = { | 88 constexpr std::array<const char* const, 3> kPrinterAttributes{ |
89 kPrinterState, kPrinterStateReasons, kPrinterStateMessage}; | 89 {kPrinterState, kPrinterStateReasons, kPrinterStateMessage}}; |
90 | 90 |
91 std::unique_ptr<ipp_t, void (*)(ipp_t*)> WrapIpp(ipp_t* ipp) { | 91 std::unique_ptr<ipp_t, void (*)(ipp_t*)> WrapIpp(ipp_t* ipp) { |
92 return std::unique_ptr<ipp_t, void (*)(ipp_t*)>(ipp, &ippDelete); | 92 return std::unique_ptr<ipp_t, void (*)(ipp_t*)>(ipp, &ippDelete); |
93 } | 93 } |
94 | 94 |
95 // Converts an IPP attribute |attr| to the appropriate JobState enum. | 95 // Converts an IPP attribute |attr| to the appropriate JobState enum. |
96 CupsJob::JobState ToJobState(ipp_attribute_t* attr) { | 96 CupsJob::JobState ToJobState(ipp_attribute_t* attr) { |
97 DCHECK_EQ(IPP_TAG_ENUM, ippGetValueTag(attr)); | 97 DCHECK_EQ(IPP_TAG_ENUM, ippGetValueTag(attr)); |
98 int state = ippGetInteger(attr, 0); | 98 int state = ippGetInteger(attr, 0); |
99 switch (state) { | 99 switch (state) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 LOG(WARNING) << "IPP Error: " << cupsLastErrorString(); | 387 LOG(WARNING) << "IPP Error: " << cupsLastErrorString(); |
388 return false; | 388 return false; |
389 } | 389 } |
390 | 390 |
391 ParseJobsResponse(response.get(), printer_id, jobs); | 391 ParseJobsResponse(response.get(), printer_id, jobs); |
392 | 392 |
393 return true; | 393 return true; |
394 } | 394 } |
395 | 395 |
396 } // namespace printing | 396 } // namespace printing |
OLD | NEW |