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 // chromeos::RemovableDeviceNotificationsCros listens for mount point changes | 5 // chromeos::RemovableDeviceNotificationsCros listens for mount point changes |
6 // and notifies the SystemMonitor about the addition and deletion of media | 6 // and notifies the SystemMonitor about the addition and deletion of media |
7 // devices. | 7 // devices. |
8 | 8 |
9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ | 9 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ |
10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ | 10 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS_H_ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 disks::DiskMountManager::MountEvent event_type, | 53 disks::DiskMountManager::MountEvent event_type, |
54 MountError error_code, | 54 MountError error_code, |
55 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; | 55 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE; |
56 | 56 |
57 // Finds the device that contains |path| and populates |device_info|. | 57 // Finds the device that contains |path| and populates |device_info|. |
58 // Returns false if unable to find the device. | 58 // Returns false if unable to find the device. |
59 bool GetDeviceInfoForPath( | 59 bool GetDeviceInfoForPath( |
60 const FilePath& path, | 60 const FilePath& path, |
61 base::SystemMonitor::RemovableStorageInfo* device_info) const; | 61 base::SystemMonitor::RemovableStorageInfo* device_info) const; |
62 | 62 |
63 // Returns the storage size information of the device present at |location|. | |
64 // If the requested information is unavailable, returns an empty string. | |
65 string16 GetStorageSizeInfo(const std::string& location); | |
66 | |
63 private: | 67 private: |
68 struct StorageObjectInfo { | |
69 // Basic details {storage device name, location and identifier}. | |
70 base::SystemMonitor::RemovableStorageInfo storage_info; | |
71 | |
72 // Device storage size, e.g "4 GB", "15.9 MB". | |
73 string16 storage_size_info; | |
Lei Zhang
2012/11/09 01:12:18
How about storage_size_str ?
Lei Zhang
2012/11/09 04:47:05
BTW, have you considered just storing this as a ui
kmadhusu
2012/11/09 21:59:40
storage_size_info -> storage_size.
kmadhusu
2012/11/09 21:59:40
I don't see any reason to store this as uint64. Ev
Lei Zhang
2012/11/12 07:46:56
So with this CL and the Linux equivalent, both rem
kmadhusu
2012/11/12 19:56:56
Done.
| |
74 }; | |
75 | |
64 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>; | 76 friend class base::RefCountedThreadSafe<RemovableDeviceNotificationsCros>; |
65 | 77 |
66 // Mapping of mount path to removable mass storage info. | 78 // Mapping of mount path to removable mass storage info. |
67 typedef std::map<std::string, base::SystemMonitor::RemovableStorageInfo> | 79 typedef std::map<std::string, StorageObjectInfo> MountMap; |
68 MountMap; | |
69 | 80 |
70 // Private to avoid code deleting the object. | 81 // Private to avoid code deleting the object. |
71 virtual ~RemovableDeviceNotificationsCros(); | 82 virtual ~RemovableDeviceNotificationsCros(); |
72 | 83 |
73 // Checks existing mount points map for media devices. For each mount point, | 84 // Checks existing mount points map for media devices. For each mount point, |
74 // call CheckMountedPathOnFileThread() below. | 85 // call CheckMountedPathOnFileThread() below. |
75 void CheckExistingMountPointsOnUIThread(); | 86 void CheckExistingMountPointsOnUIThread(); |
76 | 87 |
77 // Checks if the mount point in |mount_info| is a media device. If it is, | 88 // Checks if the mount point in |mount_info| is a media device. If it is, |
78 // then continue with AddMountedPathOnUIThread() below. | 89 // then continue with AddMountedPathOnUIThread() below. |
(...skipping 10 matching lines...) Expand all Loading... | |
89 // Mapping of relevant mount points and their corresponding mount devices. | 100 // Mapping of relevant mount points and their corresponding mount devices. |
90 // Only accessed on the UI thread. | 101 // Only accessed on the UI thread. |
91 MountMap mount_map_; | 102 MountMap mount_map_; |
92 | 103 |
93 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); | 104 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCros); |
94 }; | 105 }; |
95 | 106 |
96 } // namespace chromeos | 107 } // namespace chromeos |
97 | 108 |
98 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_ | 109 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_CHROMEOS _H_ |
OLD | NEW |