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 // StorageMonitorLinux implementation. | 5 // StorageMonitorLinux implementation. |
6 | 6 |
7 #include "chrome/browser/storage_monitor/storage_monitor_linux.h" | 7 #include "chrome/browser/storage_monitor/storage_monitor_linux.h" |
8 | 8 |
9 #include <mntent.h> | 9 #include <mntent.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "chrome/browser/storage_monitor/media_storage_util.h" | 23 #include "chrome/browser/storage_monitor/media_storage_util.h" |
24 #include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer
_linux.h" | 24 #include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer
_linux.h" |
25 #include "chrome/browser/storage_monitor/removable_device_constants.h" | 25 #include "chrome/browser/storage_monitor/removable_device_constants.h" |
26 #include "chrome/browser/storage_monitor/storage_info.h" | 26 #include "chrome/browser/storage_monitor/storage_info.h" |
27 #include "chrome/browser/storage_monitor/udev_util_linux.h" | 27 #include "chrome/browser/storage_monitor/udev_util_linux.h" |
28 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 28 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
29 | 29 |
30 namespace chrome { | |
31 | |
32 using content::BrowserThread; | 30 using content::BrowserThread; |
33 typedef MtabWatcherLinux::MountPointDeviceMap MountPointDeviceMap; | 31 typedef MtabWatcherLinux::MountPointDeviceMap MountPointDeviceMap; |
34 | 32 |
35 namespace { | 33 namespace { |
36 | 34 |
37 // udev device property constants. | 35 // udev device property constants. |
38 const char kBlockSubsystemKey[] = "block"; | 36 const char kBlockSubsystemKey[] = "block"; |
39 const char kDiskDeviceTypeKey[] = "disk"; | 37 const char kDiskDeviceTypeKey[] = "disk"; |
40 const char kFsUUID[] = "ID_FS_UUID"; | 38 const char kFsUUID[] = "ID_FS_UUID"; |
41 const char kLabel[] = "ID_FS_LABEL"; | 39 const char kLabel[] = "ID_FS_LABEL"; |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 mount_point_info.storage_info = *storage_info; | 510 mount_point_info.storage_info = *storage_info; |
513 mount_info_map_[mount_point] = mount_point_info; | 511 mount_info_map_[mount_point] = mount_point_info; |
514 mount_priority_map_[mount_device][mount_point] = removable; | 512 mount_priority_map_[mount_device][mount_point] = removable; |
515 receiver()->ProcessAttach(*storage_info); | 513 receiver()->ProcessAttach(*storage_info); |
516 } | 514 } |
517 | 515 |
518 StorageMonitor* StorageMonitor::Create() { | 516 StorageMonitor* StorageMonitor::Create() { |
519 const base::FilePath kDefaultMtabPath("/etc/mtab"); | 517 const base::FilePath kDefaultMtabPath("/etc/mtab"); |
520 return new StorageMonitorLinux(kDefaultMtabPath); | 518 return new StorageMonitorLinux(kDefaultMtabPath); |
521 } | 519 } |
522 | |
523 } // namespace chrome | |
OLD | NEW |