Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / device_monitor_udev.h
blob4a879ef5d4d2c4c51db7f449182ca450ce97f8e5
1 // Copyright 2013 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.
5 // This class is used to detect device change and notify base::SystemMonitor
6 // on Linux.
8 #ifndef CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_
9 #define CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h"
15 extern "C" {
16 struct udev_device;
19 namespace content {
21 class UdevLinux;
23 class DeviceMonitorLinux : public base::MessageLoop::DestructionObserver {
24 public:
25 DeviceMonitorLinux();
26 ~DeviceMonitorLinux() override;
28 private:
29 // This object is deleted on the UI thread after the IO thread has been
30 // destroyed. Need to know when IO thread is being destroyed so that
31 // we can delete udev_.
32 void WillDestroyCurrentMessageLoop() override;
34 void Initialize();
35 void OnDevicesChanged(udev_device* device);
37 scoped_ptr<UdevLinux> udev_;
39 DISALLOW_COPY_AND_ASSIGN(DeviceMonitorLinux);
42 } // namespace content
44 #endif // CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_