Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: chromeos/disks/disk_mount_manager.h

Issue 10874067: chromeos: Move src/chrome/browser/chromeos/disks to src/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/disks/disk_mount_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CHROME_BROWSER_CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 5 #ifndef CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
6 #define CHROME_BROWSER_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 "chromeos/chromeos_export.h"
10 #include "chromeos/dbus/cros_disks_client.h" 11 #include "chromeos/dbus/cros_disks_client.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 namespace disks { 14 namespace disks {
14 15
15 // Types of events DiskMountManager sends to its observers. 16 // Types of events DiskMountManager sends to its observers.
16 enum DiskMountManagerEventType { 17 enum DiskMountManagerEventType {
17 MOUNT_DISK_ADDED, 18 MOUNT_DISK_ADDED,
18 MOUNT_DISK_REMOVED, 19 MOUNT_DISK_REMOVED,
19 MOUNT_DISK_CHANGED, 20 MOUNT_DISK_CHANGED,
20 MOUNT_DISK_MOUNTED, 21 MOUNT_DISK_MOUNTED,
21 MOUNT_DISK_UNMOUNTED, 22 MOUNT_DISK_UNMOUNTED,
22 MOUNT_DEVICE_ADDED, 23 MOUNT_DEVICE_ADDED,
23 MOUNT_DEVICE_REMOVED, 24 MOUNT_DEVICE_REMOVED,
24 MOUNT_DEVICE_SCANNED, 25 MOUNT_DEVICE_SCANNED,
25 MOUNT_FORMATTING_STARTED, 26 MOUNT_FORMATTING_STARTED,
26 MOUNT_FORMATTING_FINISHED, 27 MOUNT_FORMATTING_FINISHED,
27 }; 28 };
28 29
29 // Condition of mounted filesystem. 30 // Condition of mounted filesystem.
30 enum MountCondition { 31 enum MountCondition {
31 MOUNT_CONDITION_NONE, 32 MOUNT_CONDITION_NONE,
32 MOUNT_CONDITION_UNKNOWN_FILESYSTEM, 33 MOUNT_CONDITION_UNKNOWN_FILESYSTEM,
33 MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM, 34 MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM,
34 }; 35 };
35 36
36 // This class handles the interaction with cros-disks. 37 // This class handles the interaction with cros-disks.
37 // Other classes can add themselves as observers. 38 // Other classes can add themselves as observers.
38 class DiskMountManager { 39 class CHROMEOS_EXPORT DiskMountManager {
39 public: 40 public:
40 // Event type given to observers' MountCompleted method. 41 // Event type given to observers' MountCompleted method.
41 enum MountEvent { 42 enum MountEvent {
42 MOUNTING, 43 MOUNTING,
43 UNMOUNTING, 44 UNMOUNTING,
44 }; 45 };
45 46
46 // Used to house an instance of each found mount device. 47 // Used to house an instance of each found mount device.
47 class Disk { 48 class Disk {
48 public: 49 public:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 211
211 // Mounts a device. 212 // Mounts a device.
212 virtual void MountPath(const std::string& source_path, 213 virtual void MountPath(const std::string& source_path,
213 const std::string& source_format, 214 const std::string& source_format,
214 const std::string& mount_label, 215 const std::string& mount_label,
215 MountType type) = 0; 216 MountType type) = 0;
216 217
217 // Unmounts a mounted disk. 218 // Unmounts a mounted disk.
218 virtual void UnmountPath(const std::string& mount_path) = 0; 219 virtual void UnmountPath(const std::string& mount_path) = 0;
219 220
220 // Retrieves total and remaining available size on |mount_path|.
221 virtual void GetSizeStatsOnFileThread(const std::string& mount_path,
222 size_t* total_size_kb,
223 size_t* remaining_size_kb) = 0;
224 // Formats device given its file path. 221 // Formats device given its file path.
225 // Example: file_path: /dev/sdb1 222 // Example: file_path: /dev/sdb1
226 virtual void FormatUnmountedDevice(const std::string& file_path) = 0; 223 virtual void FormatUnmountedDevice(const std::string& file_path) = 0;
227 224
228 // Formats Device given its mount path. Unmounts the device. 225 // Formats Device given its mount path. Unmounts the device.
229 // Example: mount_path: /media/VOLUME_LABEL 226 // Example: mount_path: /media/VOLUME_LABEL
230 virtual void FormatMountedDevice(const std::string& mount_path) = 0; 227 virtual void FormatMountedDevice(const std::string& mount_path) = 0;
231 228
232 // Unmounts device_path and all of its known children. 229 // Unmounts device_path and all of its known children.
233 virtual void UnmountDeviceRecursive( 230 virtual void UnmountDeviceRecursive(
(...skipping 26 matching lines...) Expand all
260 static void Shutdown(); 257 static void Shutdown();
261 258
262 // Returns a pointer to the global DiskMountManager instance. 259 // Returns a pointer to the global DiskMountManager instance.
263 // Initialize() should already have been called. 260 // Initialize() should already have been called.
264 static DiskMountManager* GetInstance(); 261 static DiskMountManager* GetInstance();
265 }; 262 };
266 263
267 } // namespace disks 264 } // namespace disks
268 } // namespace chromeos 265 } // namespace chromeos
269 266
270 #endif // CHROME_BROWSER_CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 267 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/disks/disk_mount_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698