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

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

Issue 12537016: Add callback to DiskMountManager::UnmountPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
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 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 }; 189 };
190 190
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.
199 typedef base::Callback<void(MountError error_code)> UnmountPathCallback;
200
198 // Implement this interface to be notified about disk/mount related events. 201 // Implement this interface to be notified about disk/mount related events.
199 class Observer { 202 class Observer {
200 public: 203 public:
201 virtual ~Observer() {} 204 virtual ~Observer() {}
202 205
203 // Called when disk mount status is changed. 206 // Called when disk mount status is changed.
204 virtual void OnDiskEvent(DiskEvent event, const Disk* disk) = 0; 207 virtual void OnDiskEvent(DiskEvent event, const Disk* disk) = 0;
205 // Called when device status is changed. 208 // Called when device status is changed.
206 virtual void OnDeviceEvent(DeviceEvent event, 209 virtual void OnDeviceEvent(DeviceEvent event,
207 const std::string& device_path) = 0; 210 const std::string& device_path) = 0;
(...skipping 22 matching lines...) Expand all
230 virtual const Disk* FindDiskBySourcePath( 233 virtual const Disk* FindDiskBySourcePath(
231 const std::string& source_path) const = 0; 234 const std::string& source_path) const = 0;
232 235
233 // Gets the list of mount points. 236 // Gets the list of mount points.
234 virtual const MountPointMap& mount_points() const = 0; 237 virtual const MountPointMap& mount_points() const = 0;
235 238
236 // Requests refreshing all the information about mounted disks. 239 // Requests refreshing all the information about mounted disks.
237 virtual void RequestMountInfoRefresh() = 0; 240 virtual void RequestMountInfoRefresh() = 0;
238 241
239 // Mounts a device. 242 // Mounts a device.
243 // Note that the mount operation may fail. To find out the result, one should
244 // observe DiskMountManager for |Observer::OnMountEvent| event, which will be
245 // raised upon the mount operation completion.
240 virtual void MountPath(const std::string& source_path, 246 virtual void MountPath(const std::string& source_path,
241 const std::string& source_format, 247 const std::string& source_format,
242 const std::string& mount_label, 248 const std::string& mount_label,
243 MountType type) = 0; 249 MountType type) = 0;
244 250
245 // Unmounts a mounted disk. 251 // Unmounts a mounted disk.
246 // |UnmountOptions| enum defined in chromeos/dbus/cros_disks_client.h. 252 // |UnmountOptions| enum defined in chromeos/dbus/cros_disks_client.h.
253 // When the method is complete, |callback| will be called and observers'
254 // |OnMountEvent| will be raised.
satorux1 2013/03/14 00:58:43 Please comment that |callback| can be optional (ca
tbarzic 2013/03/14 01:10:03 I agree, I don't like optional parameters in gener
247 virtual void UnmountPath(const std::string& mount_path, 255 virtual void UnmountPath(const std::string& mount_path,
248 UnmountOptions options) = 0; 256 UnmountOptions options,
257 const UnmountPathCallback& callback) = 0;
249 258
250 // Formats Device given its mount path. Unmounts the device. 259 // Formats Device given its mount path. Unmounts the device.
251 // Example: mount_path: /media/VOLUME_LABEL 260 // Example: mount_path: /media/VOLUME_LABEL
252 virtual void FormatMountedDevice(const std::string& mount_path) = 0; 261 virtual void FormatMountedDevice(const std::string& mount_path) = 0;
253 262
254 // Unmounts device_path and all of its known children. 263 // Unmounts device_path and all of its known children.
255 virtual void UnmountDeviceRecursively( 264 virtual void UnmountDeviceRecursively(
256 const std::string& device_path, 265 const std::string& device_path,
257 const UnmountDeviceRecursivelyCallbackType& callback) = 0; 266 const UnmountDeviceRecursivelyCallbackType& callback) = 0;
258 267
(...skipping 28 matching lines...) Expand all
287 296
288 // Returns a pointer to the global DiskMountManager instance. 297 // Returns a pointer to the global DiskMountManager instance.
289 // Initialize() should already have been called. 298 // Initialize() should already have been called.
290 static DiskMountManager* GetInstance(); 299 static DiskMountManager* GetInstance();
291 }; 300 };
292 301
293 } // namespace disks 302 } // namespace disks
294 } // namespace chromeos 303 } // namespace chromeos
295 304
296 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 305 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/imageburner/burn_device_handler_unittest.cc ('k') | chromeos/disks/disk_mount_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698