| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Unmounts device_path and all of its known children. | 265 // Unmounts device_path and all of its known children. |
| 266 virtual void UnmountDeviceRecursively( | 266 virtual void UnmountDeviceRecursively( |
| 267 const std::string& device_path, | 267 const std::string& device_path, |
| 268 const UnmountDeviceRecursivelyCallbackType& callback) = 0; | 268 const UnmountDeviceRecursivelyCallbackType& callback) = 0; |
| 269 | 269 |
| 270 // Used in tests to initialize the manager's disk and mount point sets. | 270 // Used in tests to initialize the manager's disk and mount point sets. |
| 271 // Default implementation does noting. It just fails. | 271 // Default implementation does noting. It just fails. |
| 272 virtual bool AddDiskForTest(Disk* disk); | 272 virtual bool AddDiskForTest(Disk* disk); |
| 273 virtual bool AddMountPointForTest(const MountPointInfo& mount_point); | 273 virtual bool AddMountPointForTest(const MountPointInfo& mount_point); |
| 274 | 274 |
| 275 // Returns corresponding string to |type| like "device" or "file". | |
| 276 static std::string MountTypeToString(MountType type); | |
| 277 | |
| 278 // The inverse function of MountTypeToString. | |
| 279 static MountType MountTypeFromString(const std::string& type_str); | |
| 280 | |
| 281 // Returns corresponding string to |type| like "unknown_filesystem". | 275 // Returns corresponding string to |type| like "unknown_filesystem". |
| 282 static std::string MountConditionToString(MountCondition type); | 276 static std::string MountConditionToString(MountCondition type); |
| 283 | 277 |
| 284 // Returns corresponding string to |type|, like "sd", "usb". | 278 // Returns corresponding string to |type|, like "sd", "usb". |
| 285 static std::string DeviceTypeToString(DeviceType type); | 279 static std::string DeviceTypeToString(DeviceType type); |
| 286 | 280 |
| 287 // Creates the global DiskMountManager instance. | 281 // Creates the global DiskMountManager instance. |
| 288 static void Initialize(); | 282 static void Initialize(); |
| 289 | 283 |
| 290 // Similar to Initialize(), but can inject an alternative | 284 // Similar to Initialize(), but can inject an alternative |
| 291 // DiskMountManager such as MockDiskMountManager for testing. | 285 // DiskMountManager such as MockDiskMountManager for testing. |
| 292 // The injected object will be owned by the internal pointer and deleted | 286 // The injected object will be owned by the internal pointer and deleted |
| 293 // by Shutdown(). | 287 // by Shutdown(). |
| 294 static void InitializeForTesting(DiskMountManager* disk_mount_manager); | 288 static void InitializeForTesting(DiskMountManager* disk_mount_manager); |
| 295 | 289 |
| 296 // Destroys the global DiskMountManager instance if it exists. | 290 // Destroys the global DiskMountManager instance if it exists. |
| 297 static void Shutdown(); | 291 static void Shutdown(); |
| 298 | 292 |
| 299 // Returns a pointer to the global DiskMountManager instance. | 293 // Returns a pointer to the global DiskMountManager instance. |
| 300 // Initialize() should already have been called. | 294 // Initialize() should already have been called. |
| 301 static DiskMountManager* GetInstance(); | 295 static DiskMountManager* GetInstance(); |
| 302 }; | 296 }; |
| 303 | 297 |
| 304 } // namespace disks | 298 } // namespace disks |
| 305 } // namespace chromeos | 299 } // namespace chromeos |
| 306 | 300 |
| 307 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ | 301 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ |
| OLD | NEW |