OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_CHROMEOS_PRINTER_DETECTOR_USB_PRINTER_DETECTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PRINTER_DETECTOR_USB_PRINTER_DETECTOR_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/macros.h" |
| 13 #include "chromeos/printing/printer_configuration.h" |
| 14 #include "components/keyed_service/core/keyed_service.h" |
| 15 |
| 16 class Profile; |
| 17 |
| 18 namespace chromeos { |
| 19 |
| 20 // Observes device::UsbService for addition of USB printers (devices with |
| 21 // interface class 7). When a device is detected, it is forwarded to the |
| 22 // printing subsystem for either autoconfiguration or user guidance. |
| 23 class UsbPrinterDetector : public KeyedService { |
| 24 public: |
| 25 class Observer { |
| 26 public: |
| 27 virtual ~Observer() = default; |
| 28 |
| 29 // The set of available printers has changed. |
| 30 virtual void OnAvailableUsbPrintersChanged( |
| 31 const std::vector<Printer>& printers) = 0; |
| 32 }; |
| 33 |
| 34 // Factory function for the CUPS implementation. |
| 35 static std::unique_ptr<UsbPrinterDetector> Create(Profile* profile); |
| 36 ~UsbPrinterDetector() override = default; |
| 37 |
| 38 virtual void AddObserver(Observer* observer) = 0; |
| 39 virtual void RemoveObserver(Observer* observer) = 0; |
| 40 |
| 41 // Get the current set of detected printers. |
| 42 virtual std::vector<Printer> GetPrinters() = 0; |
| 43 |
| 44 protected: |
| 45 UsbPrinterDetector() = default; |
| 46 |
| 47 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(UsbPrinterDetector); |
| 49 }; |
| 50 |
| 51 } // namespace chromeos |
| 52 |
| 53 #endif // CHROME_BROWSER_CHROMEOS_PRINTER_DETECTOR_USB_PRINTER_DETECTOR_H_ |
OLD | NEW |