Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / storage_monitor / udev_util_linux.h
blob31497560ed4774d8797976c3191c828daa438f1d
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
8 #include <libudev.h>
10 #include <string>
12 #include "base/memory/scoped_ptr.h"
14 namespace base {
15 class FilePath;
18 // Deleter for ScopedUdevObject.
19 struct UdevDeleter {
20 void operator()(struct udev* udev);
22 typedef scoped_ptr<struct udev, UdevDeleter> ScopedUdevObject;
24 // Deleter for ScopedUdevDeviceObject().
25 struct UdevDeviceDeleter {
26 void operator()(struct udev_device* device);
28 typedef scoped_ptr<struct udev_device, UdevDeviceDeleter>
29 ScopedUdevDeviceObject;
31 // Wrapper function for udev_device_get_property_value() that also checks for
32 // valid but empty values.
33 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device,
34 const char* key);
36 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value()
37 // pair. |device_path| is the absolute path to the device, including /sys.
38 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
39 const char* key,
40 std::string* result);
42 #endif // CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_