OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 DEVICE_CORE_DEVICE_MONITOR_WIN_H_ | |
6 #define DEVICE_CORE_DEVICE_MONITOR_WIN_H_ | |
7 | |
8 #include <windows.h> | |
9 | |
10 #include "base/observer_list.h" | |
11 #include "device/core/device_core_export.h" | |
12 | |
13 namespace device { | |
14 | |
15 // Use an instance of this class to observe devices being added and removed | |
16 // from the system, matched by device interface GUID. | |
17 class DEVICE_CORE_EXPORT DeviceMonitorWin { | |
18 public: | |
19 class DEVICE_CORE_EXPORT Observer { | |
20 public: | |
21 virtual void OnDeviceAdded(const GUID& class_guid, | |
22 const std::string& device_path); | |
23 virtual void OnDeviceRemoved(const GUID& class_guid, | |
24 const std::string& device_path); | |
25 }; | |
26 | |
27 ~DeviceMonitorWin(); | |
28 | |
29 static DeviceMonitorWin* GetForDeviceInterface(const GUID& guid); | |
30 static DeviceMonitorWin* GetForAllInterfaces(); | |
31 | |
32 void AddObserver(Observer* observer); | |
33 void RemoveObserver(Observer* observer); | |
34 | |
35 private: | |
36 friend class DeviceMonitorMessageWindow; | |
37 | |
38 DeviceMonitorWin(); | |
39 | |
40 void NotifyDeviceAdded(const GUID& class_guid, | |
41 const std::string& device_path); | |
42 void NotifyDeviceRemoved(const GUID& class_guid, | |
43 const std::string& device_path); | |
44 | |
45 base::ObserverList<Observer> observer_list_; | |
46 }; | |
47 | |
48 } // namespace device | |
49 | |
50 #endif // DEVICE_CORE_DEVICE_MONITOR_WIN_H_ | |
OLD | NEW |