OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 DEVICE_HID_DEVICE_MONITOR_LINUX_H_ | 5 #ifndef DEVICE_BASE_DEVICE_MONITOR_LINUX_H_ |
6 #define DEVICE_HID_DEVICE_MONITOR_LINUX_H_ | 6 #define DEVICE_BASE_DEVICE_MONITOR_LINUX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_descriptor_watcher_posix.h" | 12 #include "base/files/file_descriptor_watcher_posix.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "device/core/device_core_export.h" | 17 #include "device/base/device_base_export.h" |
18 #include "device/udev_linux/scoped_udev.h" | 18 #include "device/udev_linux/scoped_udev.h" |
19 | 19 |
20 struct udev_device; | 20 struct udev_device; |
21 | 21 |
22 namespace device { | 22 namespace device { |
23 | 23 |
24 // This class listends for notifications from libudev about | 24 // This class listends for notifications from libudev about |
25 // connected/disconnected devices. This class is *NOT* thread-safe. | 25 // connected/disconnected devices. This class is *NOT* thread-safe. |
26 class DEVICE_CORE_EXPORT DeviceMonitorLinux | 26 class DEVICE_BASE_EXPORT DeviceMonitorLinux |
27 : public base::MessageLoop::DestructionObserver { | 27 : public base::MessageLoop::DestructionObserver { |
28 public: | 28 public: |
29 typedef base::Callback<void(udev_device* device)> EnumerateCallback; | 29 typedef base::Callback<void(udev_device* device)> EnumerateCallback; |
30 | 30 |
31 class Observer { | 31 class Observer { |
32 public: | 32 public: |
33 virtual ~Observer() {} | 33 virtual ~Observer() {} |
34 virtual void OnDeviceAdded(udev_device* device) = 0; | 34 virtual void OnDeviceAdded(udev_device* device) = 0; |
35 virtual void OnDeviceRemoved(udev_device* device) = 0; | 35 virtual void OnDeviceRemoved(udev_device* device) = 0; |
36 virtual void WillDestroyMonitorMessageLoop() = 0; | 36 virtual void WillDestroyMonitorMessageLoop() = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
64 | 64 |
65 base::ObserverList<Observer, true> observers_; | 65 base::ObserverList<Observer, true> observers_; |
66 | 66 |
67 base::ThreadChecker thread_checker_; | 67 base::ThreadChecker thread_checker_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(DeviceMonitorLinux); | 69 DISALLOW_COPY_AND_ASSIGN(DeviceMonitorLinux); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace device | 72 } // namespace device |
73 | 73 |
74 #endif // DEVICE_HID_DEVICE_MONITOR_LINUX_H_ | 74 #endif // DEVICE_BASE_DEVICE_MONITOR_LINUX_H_ |
OLD | NEW |