Do lazy unmount only when the disk has been physically removed.
Also, wire up unmount failure event to file manager so error message
for unmount failure can e displayed.
TEST=manual
(try unmounting USB while copying a file to the device ->
unmount should fail and error message should be displayed;
remove USB while copying a file to it in progress ->
the device should be unmounted)
BUG=154403
Review URL: https://chromiumcodereview.appspot.com/11099004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161072 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chromeos/dbus/cros_disks_client.h b/chromeos/dbus/cros_disks_client.h
index 3590ca6..62cc67b9 100644
--- a/chromeos/dbus/cros_disks_client.h
+++ b/chromeos/dbus/cros_disks_client.h
@@ -18,6 +18,8 @@
class Response;
}
+// TODO(tbarzic): We should probably move these enums inside CrosDisksClient,
+// to be clearer where they come from.
namespace chromeos {
// Enum describing types of mount used by cros-disks.
@@ -64,6 +66,12 @@
FORMATTING_FINISHED,
};
+// Additional unmount flags to be added to unmount request.
+enum UnmountOptions {
+ UNMOUNT_OPTIONS_NONE,
+ UNMOUNT_OPTIONS_LAZY, // Do lazy unmount.
+};
+
// A class to represent information about a disk sent from cros-disks.
class DiskInfo {
public:
@@ -219,8 +227,9 @@
// Calls Unmount method. |callback| is called after the method call succeeds,
// otherwise, |error_callback| is called.
virtual void Unmount(const std::string& device_path,
+ UnmountOptions options,
const UnmountCallback& callback,
- const ErrorCallback& error_callback) = 0;
+ const UnmountCallback& error_callback) = 0;
// Calls EnumerateAutoMountableDevices method. |callback| is called after the
// method call succeeds, otherwise, |error_callback| is called.