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

Unified Diff: chrome/browser/chromeos/printer_detector/printer_detector.h

Issue 2790603003: Make CUPS USB printing play better with the settings page. This change does several things: (Closed)
Patch Set: stop latching PrintersManager, add comments Created 3 years, 8 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/printer_detector/printer_detector.h
diff --git a/chrome/browser/chromeos/printer_detector/printer_detector.h b/chrome/browser/chromeos/printer_detector/printer_detector.h
index e7a5b3d5828d89b36b25bbf817639688f68f11d0..1789377df473c48e3d70b2087bfaa11f7f732854 100644
--- a/chrome/browser/chromeos/printer_detector/printer_detector.h
+++ b/chrome/browser/chromeos/printer_detector/printer_detector.h
@@ -7,8 +7,10 @@
#include <memory>
#include <string>
+#include <vector>
#include "base/macros.h"
+#include "chromeos/printing/printer_configuration.h"
#include "components/keyed_service/core/keyed_service.h"
class NotificationUIManager;
@@ -34,6 +36,15 @@ namespace chromeos {
// CUPS backend.
class PrinterDetector : public KeyedService {
public:
+ class Observer {
+ public:
+ virtual ~Observer() = default;
+
+ // The set of available printers has changed.
+ virtual void OnAvailableUsbPrintersChanged(
+ const std::vector<Printer>& printers) = 0;
+ };
+
// Factory function for the Legacy implementation.
static std::unique_ptr<PrinterDetector> CreateLegacy(Profile* profile);
@@ -41,6 +52,16 @@ class PrinterDetector : public KeyedService {
static std::unique_ptr<PrinterDetector> CreateCups(Profile* profile);
~PrinterDetector() override {}
+ // Observer management. Note these are only implemented for the cups backend.
+ // TODO(justincarlson) - Change these all to pure virtual functions when the
+ // legacy backend is retired.
+
+ virtual void AddObserver(Observer* observer) {}
+ virtual void RemoveObserver(Observer* observer) {}
+
+ // Get the current set of detected printers.
+ virtual std::vector<Printer> GetPrinters();
+
protected:
PrinterDetector() = default;

Powered by Google App Engine
This is Rietveld 408576698