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

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

Issue 2738323003: Implement basic USB setup in the cups printer detector. Factor out (Closed)
Patch Set: Fix ppd provider lifetime. It was being inappropriately deleted which meant it caused USB resoluti… Created 3 years, 9 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
Index: chrome/browser/chromeos/printing/usb_printer_util.h
diff --git a/chrome/browser/chromeos/printing/usb_printer_util.h b/chrome/browser/chromeos/printing/usb_printer_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ce404eb5bd117d4c5baeeaa00d0baeb0d302919
--- /dev/null
+++ b/chrome/browser/chromeos/printing/usb_printer_util.h
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Utility routines for working with UsbDevices that are printers.
+
+#ifndef CHROME_BROWSER_CHROMEOS_PRINTING_USB_PRINTER_UTIL_H__
+#define CHROME_BROWSER_CHROMEOS_PRINTING_USB_PRINTER_UTIL_H__
+
+#include <memory>
+#include <string>
+
+#include "base/memory/ref_counted.h"
+
+namespace device {
+class UsbDevice;
+}
+
+namespace chromeos {
+
+class Printer;
+
+bool UsbDeviceIsPrinter(scoped_refptr<device::UsbDevice> usb_device);
+
+// Convert the interesting details of a device to a string, for
+// logging/debugging.
+std::string UsbPrinterDeviceDetailsAsString(const device::UsbDevice& device);
+
+// Attempt to gather all the information we need to work with this printer by
+// querying the USB device. This should only be called using devices we believe
+// are printers, not arbitrary USB devices, as we may get weird partial results
+// from arbitrary devices.
+//
+// Returns nullptr and logs an error on failure.
+std::unique_ptr<Printer> UsbDeviceToPrinter(const device::UsbDevice& device);
+
+// Gets the URI CUPS would use to refer to this USB device. Assumes device
+// is a printer.
+std::string UsbPrinterUri(const device::UsbDevice& device);
+
+} // namespace chromeos
+#endif // CHROME_BROWSER_CHROMEOS_PRINTING_USB_PRINTER_UTIL_H__
« no previous file with comments | « chrome/browser/chromeos/printing/printer_configurer.cc ('k') | chrome/browser/chromeos/printing/usb_printer_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698