OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Utility routines for working with UsbDevices that are printers. | |
6 | |
7 #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_USB_UTIL_H__ | |
8 #define CHROME_BROWSER_CHROMEOS_PRINTING_USB_UTIL_H__ | |
stevenjb
2017/03/17 17:34:11
nit: Even though this is in chromeos/printing, it
Carlson
2017/03/17 18:47:34
Done.
| |
9 | |
10 #include <memory> | |
11 #include <string> | |
12 | |
13 #include "base/memory/ref_counted.h" | |
14 | |
15 namespace device { | |
16 class UsbDevice; | |
17 } | |
18 | |
19 namespace chromeos { | |
20 | |
21 class Printer; | |
22 | |
23 bool UsbDeviceIsPrinter(scoped_refptr<device::UsbDevice> usb_device); | |
24 | |
25 // Convert the interesting details of a device to a string, for | |
26 // logging/debugging. | |
27 std::string UsbPrinterDeviceDetailsAsString(const device::UsbDevice& device); | |
28 | |
29 // Attempt to gather all the information we need to work with this printer by | |
30 // querying the USB device. This should only be called using devices we believe | |
31 // are printers, not arbitrary USB devices, as we may get weird partial results | |
32 // from arbitrary devices. | |
33 // | |
34 // Returns nullptr and logs an error on failure. | |
35 std::unique_ptr<Printer> UsbDeviceToPrinter(const device::UsbDevice& device); | |
36 | |
37 // Gets the URI CUPS would use to refer to this USB device. Assumes device | |
38 // is a printer. | |
39 std::string UsbPrinterUri(const device::UsbDevice& device); | |
40 | |
41 } // namespace chromeos | |
42 #endif // CHROME_BROWSER_CHROMEOS_PRINTING_USB_UTIL_H__ | |
OLD | NEW |