| Index: chromeos/printing/printer_configuration.cc
|
| diff --git a/chromeos/printing/printer_configuration.cc b/chromeos/printing/printer_configuration.cc
|
| index aac6a9633f66eba488c7bf9f306eca05a562e3c6..5c8c0881289c5057088536422adcbe1117a9953d 100644
|
| --- a/chromeos/printing/printer_configuration.cc
|
| +++ b/chromeos/printing/printer_configuration.cc
|
| @@ -7,6 +7,7 @@
|
| #include <string>
|
|
|
| #include "base/guid.h"
|
| +#include "base/strings/string_piece.h"
|
|
|
| namespace chromeos {
|
|
|
| @@ -30,4 +31,31 @@ bool Printer::IsIppEverywhere() const {
|
| return ppd_reference_.autoconf;
|
| }
|
|
|
| +Printer::PrinterProtocol Printer::GetProtocol() const {
|
| + const base::StringPiece uri(uri_);
|
| +
|
| + if (uri.starts_with("usb:"))
|
| + return PrinterProtocol::USB;
|
| +
|
| + if (uri.starts_with("ipp:"))
|
| + return PrinterProtocol::IPP;
|
| +
|
| + if (uri.starts_with("ipps:"))
|
| + return PrinterProtocol::IPPS;
|
| +
|
| + if (uri.starts_with("http:"))
|
| + return PrinterProtocol::HTTP;
|
| +
|
| + if (uri.starts_with("https:"))
|
| + return PrinterProtocol::HTTPS;
|
| +
|
| + if (uri.starts_with("socket:"))
|
| + return PrinterProtocol::SOCKET;
|
| +
|
| + if (uri.starts_with("lpd:"))
|
| + return PrinterProtocol::LPD;
|
| +
|
| + return PrinterProtocol::UNKOWN;
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|