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_PRINTER_DISCOVERER_H_ | 5 #ifndef CHROMEOS_PRINTING_PRINTER_DISCOVERER_H_ |
6 #define CHROMEOS_PRINTING_PRINTER_DISCOVERER_H_ | 6 #define CHROMEOS_PRINTING_PRINTER_DISCOVERER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // Called with a collection of printers as they are discovered. Printer | 33 // Called with a collection of printers as they are discovered. Printer |
34 // objects must be copied if they are retained outside of the scope of this | 34 // objects must be copied if they are retained outside of the scope of this |
35 // function. | 35 // function. |
36 virtual void OnPrintersFound(const std::vector<Printer>& printers) {} | 36 virtual void OnPrintersFound(const std::vector<Printer>& printers) {} |
37 }; | 37 }; |
38 | 38 |
39 // Static factory | 39 // Static factory |
40 static std::unique_ptr<PrinterDiscoverer> Create(); | 40 static std::unique_ptr<PrinterDiscoverer> Create(); |
41 | 41 |
| 42 virtual ~PrinterDiscoverer() {} |
| 43 |
42 // Begin scanning for printers. Found printers will be reported to the | 44 // Begin scanning for printers. Found printers will be reported to the |
43 // attached observer. | 45 // attached observer. |
44 virtual bool StartDiscovery() = 0; | 46 virtual bool StartDiscovery() = 0; |
45 | 47 |
46 // Stop scanning for printers. Returns false if scanning could not be stopped | 48 // Stop scanning for printers. Returns false if scanning could not be stopped |
47 // and new results will continue to be be sent to observers. Returns true if | 49 // and new results will continue to be be sent to observers. Returns true if |
48 // scanning was stopped successfully. No calls to the attached observer will | 50 // scanning was stopped successfully. No calls to the attached observer will |
49 // be made after this returns if it returned true. | 51 // be made after this returns if it returned true. |
50 virtual bool StopDiscovery() = 0; | 52 virtual bool StopDiscovery() = 0; |
51 | 53 |
52 // Add an observer that will be notified of discovered printers. Ownership of | 54 // Add an observer that will be notified of discovered printers. Ownership of |
53 // |observer| is not taken by the discoverer. It is an error to add an | 55 // |observer| is not taken by the discoverer. It is an error to add an |
54 // oberserver more than once. | 56 // oberserver more than once. |
55 virtual void AddObserver(PrinterDiscoverer::Observer* observer) = 0; | 57 virtual void AddObserver(PrinterDiscoverer::Observer* observer) = 0; |
56 | 58 |
57 // Remove an observer of printer discovery. | 59 // Remove an observer of printer discovery. |
58 virtual void RemoveObserver(PrinterDiscoverer::Observer* observer) = 0; | 60 virtual void RemoveObserver(PrinterDiscoverer::Observer* observer) = 0; |
59 }; | 61 }; |
60 | 62 |
61 } // namespace chromeos | 63 } // namespace chromeos |
62 | 64 |
63 #endif // CHROMEOS_PRINTING_PRINTER_DISCOVERER_H_ | 65 #endif // CHROMEOS_PRINTING_PRINTER_DISCOVERER_H_ |
OLD | NEW |