Chromium Code Reviews| 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 #ifndef CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ | 5 #ifndef CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ |
| 6 #define CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ | 6 #define CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 // MountPointMap key is mount_path. | 191 // MountPointMap key is mount_path. |
| 192 typedef std::map<std::string, MountPointInfo> MountPointMap; | 192 typedef std::map<std::string, MountPointInfo> MountPointMap; |
| 193 | 193 |
| 194 // A callback function type which is called after UnmountDeviceRecursively | 194 // A callback function type which is called after UnmountDeviceRecursively |
| 195 // finishes. | 195 // finishes. |
| 196 typedef base::Callback<void(bool)> UnmountDeviceRecursivelyCallbackType; | 196 typedef base::Callback<void(bool)> UnmountDeviceRecursivelyCallbackType; |
| 197 | 197 |
| 198 // A callback type for UnmountPath method. | 198 // A callback type for UnmountPath method. |
| 199 typedef base::Callback<void(MountError error_code)> UnmountPathCallback; | 199 typedef base::Callback<void(MountError error_code)> UnmountPathCallback; |
| 200 | 200 |
| 201 // A callback type for EnsureMountInfoRefreshed method. | |
| 202 typedef base::Callback<void(bool success)> EnsureMountInfoRefreshedCallback; | |
| 203 | |
| 201 // Implement this interface to be notified about disk/mount related events. | 204 // Implement this interface to be notified about disk/mount related events. |
| 202 class Observer { | 205 class Observer { |
| 203 public: | 206 public: |
| 204 virtual ~Observer() {} | 207 virtual ~Observer() {} |
| 205 | 208 |
| 206 // Called when disk mount status is changed. | 209 // Called when disk mount status is changed. |
| 207 virtual void OnDiskEvent(DiskEvent event, const Disk* disk) = 0; | 210 virtual void OnDiskEvent(DiskEvent event, const Disk* disk) = 0; |
| 208 // Called when device status is changed. | 211 // Called when device status is changed. |
| 209 virtual void OnDeviceEvent(DeviceEvent event, | 212 virtual void OnDeviceEvent(DeviceEvent event, |
| 210 const std::string& device_path) = 0; | 213 const std::string& device_path) = 0; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 229 // Gets the list of disks found. | 232 // Gets the list of disks found. |
| 230 virtual const DiskMap& disks() const = 0; | 233 virtual const DiskMap& disks() const = 0; |
| 231 | 234 |
| 232 // Returns Disk object corresponding to |source_path| or NULL on failure. | 235 // Returns Disk object corresponding to |source_path| or NULL on failure. |
| 233 virtual const Disk* FindDiskBySourcePath( | 236 virtual const Disk* FindDiskBySourcePath( |
| 234 const std::string& source_path) const = 0; | 237 const std::string& source_path) const = 0; |
| 235 | 238 |
| 236 // Gets the list of mount points. | 239 // Gets the list of mount points. |
| 237 virtual const MountPointMap& mount_points() const = 0; | 240 virtual const MountPointMap& mount_points() const = 0; |
| 238 | 241 |
| 239 // Requests refreshing all the information about mounted disks. | 242 // Requests refreshing all the information about mounted disks. |
|
stevenjb
2014/07/10 00:53:21
Update comment
kinaba
2014/07/10 01:36:32
Done.
| |
| 240 virtual void RequestMountInfoRefresh() = 0; | 243 virtual void EnsureMountInfoRefreshed( |
| 244 const EnsureMountInfoRefreshedCallback& callback) = 0; | |
| 241 | 245 |
| 242 // Mounts a device. | 246 // Mounts a device. |
| 243 // Note that the mount operation may fail. To find out the result, one should | 247 // Note that the mount operation may fail. To find out the result, one should |
| 244 // observe DiskMountManager for |Observer::OnMountEvent| event, which will be | 248 // observe DiskMountManager for |Observer::OnMountEvent| event, which will be |
| 245 // raised upon the mount operation completion. | 249 // raised upon the mount operation completion. |
| 246 virtual void MountPath(const std::string& source_path, | 250 virtual void MountPath(const std::string& source_path, |
| 247 const std::string& source_format, | 251 const std::string& source_format, |
| 248 const std::string& mount_label, | 252 const std::string& mount_label, |
| 249 MountType type) = 0; | 253 MountType type) = 0; |
| 250 | 254 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 | 296 |
| 293 // Returns a pointer to the global DiskMountManager instance. | 297 // Returns a pointer to the global DiskMountManager instance. |
| 294 // Initialize() should already have been called. | 298 // Initialize() should already have been called. |
| 295 static DiskMountManager* GetInstance(); | 299 static DiskMountManager* GetInstance(); |
| 296 }; | 300 }; |
| 297 | 301 |
| 298 } // namespace disks | 302 } // namespace disks |
| 299 } // namespace chromeos | 303 } // namespace chromeos |
| 300 | 304 |
| 301 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ | 305 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ |
| OLD | NEW |