OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ | 5 #ifndef CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ |
6 #define CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ | 6 #define CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chromeos/printing/printer_configuration.h" | 12 #include "chromeos/printing/printer_configuration.h" |
13 #include "chromeos/printing/printer_discoverer.h" | 13 #include "chromeos/printing/printer_discoverer.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 class FakePrinterDiscoverer : public PrinterDiscoverer { | 17 class FakePrinterDiscoverer : public PrinterDiscoverer { |
18 public: | 18 public: |
19 FakePrinterDiscoverer(); | 19 FakePrinterDiscoverer(); |
20 ~FakePrinterDiscoverer(); | 20 ~FakePrinterDiscoverer() override; |
21 | 21 |
22 bool StartDiscovery() override; | 22 bool StartDiscovery() override; |
23 bool StopDiscovery() override; | 23 bool StopDiscovery() override; |
24 void AddObserver(PrinterDiscoverer::Observer* observer) override; | 24 void AddObserver(PrinterDiscoverer::Observer* observer) override; |
25 void RemoveObserver(PrinterDiscoverer::Observer* observer) override; | 25 void RemoveObserver(PrinterDiscoverer::Observer* observer) override; |
26 | 26 |
27 private: | 27 private: |
28 void EmitPrinters(size_t start, size_t end); | 28 void EmitPrinters(size_t start, size_t end); |
29 | 29 |
30 std::vector<chromeos::Printer> printers_; | 30 std::vector<chromeos::Printer> printers_; |
31 bool discovery_running_; | 31 bool discovery_running_; |
32 std::vector<PrinterDiscoverer::Observer*> observers_; | 32 std::vector<PrinterDiscoverer::Observer*> observers_; |
33 | 33 |
34 base::WeakPtrFactory<FakePrinterDiscoverer> weak_ptr_factory_; | 34 base::WeakPtrFactory<FakePrinterDiscoverer> weak_ptr_factory_; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(FakePrinterDiscoverer); | 36 DISALLOW_COPY_AND_ASSIGN(FakePrinterDiscoverer); |
37 }; | 37 }; |
38 | 38 |
39 } // namespace chromeos | 39 } // namespace chromeos |
40 | 40 |
41 #endif // CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ | 41 #endif // CHROMEOS_PRINTING_FAKE_PRINTER_DISCOVERER_H_ |
OLD | NEW |