Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: chrome/browser/storage_monitor/udev_util_linux.cc

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/storage_monitor/udev_util_linux.h" 5 #include "chrome/browser/storage_monitor/udev_util_linux.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 8
9 namespace chrome {
10
11 void UdevDeleter::operator()(struct udev* udev) { 9 void UdevDeleter::operator()(struct udev* udev) {
12 udev_unref(udev); 10 udev_unref(udev);
13 } 11 }
14 12
15 void UdevDeviceDeleter::operator()(struct udev_device* device) { 13 void UdevDeviceDeleter::operator()(struct udev_device* device) {
16 udev_device_unref(device); 14 udev_device_unref(device);
17 } 15 }
18 16
19 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device, 17 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device,
20 const char* key) { 18 const char* key) {
21 const char* value = udev_device_get_property_value(udev_device, key); 19 const char* value = udev_device_get_property_value(udev_device, key);
22 return value ? value : std::string(); 20 return value ? value : std::string();
23 } 21 }
24 22
25 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path, 23 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
26 const char* key, 24 const char* key,
27 std::string* result) { 25 std::string* result) {
28 ScopedUdevObject udev(udev_new()); 26 ScopedUdevObject udev(udev_new());
29 if (!udev.get()) 27 if (!udev.get())
30 return false; 28 return false;
31 ScopedUdevDeviceObject device(udev_device_new_from_syspath( 29 ScopedUdevDeviceObject device(udev_device_new_from_syspath(
32 udev.get(), device_path.value().c_str())); 30 udev.get(), device_path.value().c_str()));
33 if (!device.get()) 31 if (!device.get())
34 return false; 32 return false;
35 *result = GetUdevDevicePropertyValue(device.get(), key); 33 *result = GetUdevDevicePropertyValue(device.get(), key);
36 return true; 34 return true;
37 } 35 }
38
39 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/udev_util_linux.h ('k') | chrome/browser/storage_monitor/volume_mount_watcher_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698