diff options
author | mostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 08:36:40 +0000 |
---|---|---|
committer | mostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 08:36:40 +0000 |
commit | 49513e078c82d7cc8a7805297254a04d647759e6 (patch) | |
tree | a4b0c4cd0fd3b440c7f036279a29d5c88da615a8 /content/browser/device_monitor_udev.h | |
parent | cda7aa124d919f0ef28da4fd96b78283f83212f9 (diff) | |
download | chromium_src-49513e078c82d7cc8a7805297254a04d647759e6.zip chromium_src-49513e078c82d7cc8a7805297254a04d647759e6.tar.gz chromium_src-49513e078c82d7cc8a7805297254a04d647759e6.tar.bz2 |
Make it possible to disable udev in the content API on linux
This is useful for embedded linux setups, which often don't include udev support.
TEST=Build content_shell on linux with use_udev=0 then run ldd on output binaries to verify libudev is not listed (and is listed if built with use_udev=1 or unspecified)
BUG=318315,318413
Review URL: https://codereview.chromium.org/12374068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/device_monitor_udev.h')
-rw-r--r-- | content/browser/device_monitor_udev.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/content/browser/device_monitor_udev.h b/content/browser/device_monitor_udev.h new file mode 100644 index 0000000..b65cfc5 --- /dev/null +++ b/content/browser/device_monitor_udev.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This class is used to detect device change and notify base::SystemMonitor +// on Linux. + +#ifndef CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_ +#define CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_ + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" + +extern "C" { +struct udev_device; +} + +namespace content { + +class UdevLinux; + +class DeviceMonitorLinux : public base::MessageLoop::DestructionObserver { + public: + DeviceMonitorLinux(); + virtual ~DeviceMonitorLinux(); + + private: + // This object is deleted on the UI thread after the IO thread has been + // destroyed. Need to know when IO thread is being destroyed so that + // we can delete udev_. + virtual void WillDestroyCurrentMessageLoop() OVERRIDE; + + void Initialize(); + void OnDevicesChanged(udev_device* device); + + scoped_ptr<UdevLinux> udev_; + + DISALLOW_COPY_AND_ASSIGN(DeviceMonitorLinux); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_ |