| Index: chromeos/printing/printer_configuration.cc
|
| diff --git a/chromeos/printing/printer_configuration.cc b/chromeos/printing/printer_configuration.cc
|
| index aac6a9633f66eba488c7bf9f306eca05a562e3c6..b857bf9af5f757906f9aeeefd882553ab2907e6d 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::kUsb;
|
| +
|
| + if (uri.starts_with("ipp:"))
|
| + return PrinterProtocol::kIpp;
|
| +
|
| + if (uri.starts_with("ipps:"))
|
| + return PrinterProtocol::kIpps;
|
| +
|
| + if (uri.starts_with("http:"))
|
| + return PrinterProtocol::kHttp;
|
| +
|
| + if (uri.starts_with("https:"))
|
| + return PrinterProtocol::kHttps;
|
| +
|
| + if (uri.starts_with("socket:"))
|
| + return PrinterProtocol::kSocket;
|
| +
|
| + if (uri.starts_with("lpd:"))
|
| + return PrinterProtocol::kLpd;
|
| +
|
| + return PrinterProtocol::kUnknown;
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|