| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ipp_util.h" | 5 #include "printing/backend/cups_ipp_util.h" |
| 6 | 6 |
| 7 #include <cups/cups.h> | 7 #include <cups/cups.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 return UNKNOWN_COLOR_MODEL; | 64 return UNKNOWN_COLOR_MODEL; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool PrinterSupportsValue(const CupsOptionProvider& printer, | 67 bool PrinterSupportsValue(const CupsOptionProvider& printer, |
| 68 base::StringPiece name, | 68 base::StringPiece name, |
| 69 base::StringPiece value) { | 69 base::StringPiece value) { |
| 70 std::vector<base::StringPiece> values = | 70 std::vector<base::StringPiece> values = |
| 71 printer.GetSupportedOptionValueStrings(name); | 71 printer.GetSupportedOptionValueStrings(name); |
| 72 return ContainsValue(values, value); | 72 return base::ContainsValue(values, value); |
| 73 } | 73 } |
| 74 | 74 |
| 75 DuplexMode PrinterDefaultDuplex(const CupsOptionProvider& printer) { | 75 DuplexMode PrinterDefaultDuplex(const CupsOptionProvider& printer) { |
| 76 ipp_attribute_t* attr = printer.GetDefaultOptionValue(kIppDuplex); | 76 ipp_attribute_t* attr = printer.GetDefaultOptionValue(kIppDuplex); |
| 77 if (!attr) | 77 if (!attr) |
| 78 return UNKNOWN_DUPLEX_MODE; | 78 return UNKNOWN_DUPLEX_MODE; |
| 79 | 79 |
| 80 const char* value = ippGetString(attr, 0, nullptr); | 80 const char* value = ippGetString(attr, 0, nullptr); |
| 81 if (base::EqualsCaseInsensitiveASCII(value, CUPS_SIDES_ONE_SIDED)) | 81 if (base::EqualsCaseInsensitiveASCII(value, CUPS_SIDES_ONE_SIDED)) |
| 82 return SIMPLEX; | 82 return SIMPLEX; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 printer_info->default_paper = DefaultPaper(printer); | 292 printer_info->default_paper = DefaultPaper(printer); |
| 293 printer_info->papers = SupportedPapers(printer); | 293 printer_info->papers = SupportedPapers(printer); |
| 294 | 294 |
| 295 ExtractCopies(printer, printer_info); | 295 ExtractCopies(printer, printer_info); |
| 296 ExtractColor(printer, printer_info); | 296 ExtractColor(printer, printer_info); |
| 297 | 297 |
| 298 // TODO(skau): Add dpi and default_dpi | 298 // TODO(skau): Add dpi and default_dpi |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace printing | 301 } // namespace printing |
| OLD | NEW |