Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4962)

Unified Diff: chrome/browser/chromeos/printing/usb_printer_util.cc

Issue 2974103002: Remove requirement that USB printers have a make/model metadata (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/printing/usb_printer_util.cc
diff --git a/chrome/browser/chromeos/printing/usb_printer_util.cc b/chrome/browser/chromeos/printing/usb_printer_util.cc
index 28ae5c15e147464d74a227060c432c1ebfe28c42..011b33d8bd939ab43afbd27acac34185bb34efd0 100644
--- a/chrome/browser/chromeos/printing/usb_printer_util.cc
+++ b/chrome/browser/chromeos/printing/usb_printer_util.cc
@@ -146,12 +146,16 @@ std::string UsbPrinterDeviceDetailsAsString(const device::UsbDevice& device) {
// from arbitrary devices.
std::unique_ptr<Printer> UsbDeviceToPrinter(const device::UsbDevice& device) {
// Preflight all required fields and log errors if we find something wrong.
- if (device.vendor_id() == 0 || device.product_id() == 0 ||
- device.manufacturer_string().empty() || device.product_string().empty()) {
+ if (device.vendor_id() == 0 || device.product_id() == 0) {
LOG(ERROR) << "Failed to convert USB device to printer. Fields were:\n"
<< UsbPrinterDeviceDetailsAsString(device);
return nullptr;
}
+ if (device.manufacturer_string().empty() || device.product_string().empty()) {
+ LOG(WARNING)
+ << "Usb printer device missing make/model metadata. Fields were:\n"
+ << UsbPrinterDeviceDetailsAsString(device);
skau 2017/07/10 21:24:18 I would just skip the log. We should be pretty to
Carlson 2017/07/10 21:32:01 Added some logic to make the display name less cry
+ }
auto printer = base::MakeUnique<Printer>();
printer->set_manufacturer(base::UTF16ToUTF8(device.manufacturer_string()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698