| OLD | NEW |
| 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 // RemovableDeviceNotificationsLinux implementation. | 5 // RemovableDeviceNotificationsLinux implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
| 8 | 8 |
| 9 #include <libudev.h> | 9 #include <libudev.h> |
| 10 #include <mntent.h> | 10 #include <mntent.h> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 kDiskDeviceTypeKey); | 224 kDiskDeviceTypeKey); |
| 225 value = udev_device_get_sysattr_value(parent_device, kRemovableSysAttr); | 225 value = udev_device_get_sysattr_value(parent_device, kRemovableSysAttr); |
| 226 } | 226 } |
| 227 *removable = (value && atoi(value) == 1); | 227 *removable = (value && atoi(value) == 1); |
| 228 } | 228 } |
| 229 RecordGetDeviceInfoResult(true); | 229 RecordGetDeviceInfoResult(true); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace | 232 } // namespace |
| 233 | 233 |
| 234 RemovableDeviceNotificationsLinux::MountPointInfo::MountPointInfo() { | |
| 235 } | |
| 236 | |
| 237 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( | 234 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| 238 const FilePath& path) | 235 const FilePath& path) |
| 239 : initialized_(false), | 236 : initialized_(false), |
| 240 mtab_path_(path), | 237 mtab_path_(path), |
| 241 get_device_info_func_(&GetDeviceInfo) { | 238 get_device_info_func_(&GetDeviceInfo) { |
| 242 DCHECK(!g_removable_device_notifications_linux); | 239 DCHECK(!g_removable_device_notifications_linux); |
| 243 g_removable_device_notifications_linux = this; | 240 g_removable_device_notifications_linux = this; |
| 244 } | 241 } |
| 245 | 242 |
| 246 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( | 243 RemovableDeviceNotificationsLinux::RemovableDeviceNotificationsLinux( |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 mount_info_map_[mount_point] = mount_point_info; | 458 mount_info_map_[mount_point] = mount_point_info; |
| 462 mount_priority_map_[mount_device][mount_point] = removable; | 459 mount_priority_map_[mount_device][mount_point] = removable; |
| 463 | 460 |
| 464 if (removable) { | 461 if (removable) { |
| 465 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, | 462 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, |
| 466 mount_point.value()); | 463 mount_point.value()); |
| 467 } | 464 } |
| 468 } | 465 } |
| 469 | 466 |
| 470 } // namespace chrome | 467 } // namespace chrome |
| OLD | NEW |