diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 06:59:39 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 06:59:39 +0000 |
commit | ffdcc7a9c45e324a41012079e55e10713ebacf63 (patch) | |
tree | 32b9d5cf2773dd90b93dbd4f1585dd217ac2c90b /chromeos | |
parent | f7284760291ee2a2fb07e7ee2010a8facb5df0ff (diff) | |
download | chromium_src-ffdcc7a9c45e324a41012079e55e10713ebacf63.zip chromium_src-ffdcc7a9c45e324a41012079e55e10713ebacf63.tar.gz chromium_src-ffdcc7a9c45e324a41012079e55e10713ebacf63.tar.bz2 |
chromeos: Change CrosDisksClient::Unmount's callback type to base::Closure
CrosDisksClient::Unmount() has been just passing the argument to the callback.
BUG=None
TEST=chromeos_unittests
R=satorux@chromium.org
Review URL: https://codereview.chromium.org/18472002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/cros_disks_client.cc | 23 | ||||
-rw-r--r-- | chromeos/dbus/cros_disks_client.h | 8 | ||||
-rw-r--r-- | chromeos/dbus/fake_cros_disks_client.cc | 12 | ||||
-rw-r--r-- | chromeos/dbus/fake_cros_disks_client.h | 4 | ||||
-rw-r--r-- | chromeos/disks/disk_mount_manager.cc | 16 |
5 files changed, 30 insertions, 33 deletions
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc index 733aae6..052a3f3 100644 --- a/chromeos/dbus/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks_client.cc @@ -159,8 +159,8 @@ class CrosDisksClientImpl : public CrosDisksClient { // CrosDisksClient override. virtual void Unmount(const std::string& device_path, UnmountOptions options, - const UnmountCallback& callback, - const UnmountCallback& error_callback) OVERRIDE { + const base::Closure& callback, + const base::Closure& error_callback) OVERRIDE { dbus::MethodCall method_call(cros_disks::kCrosDisksInterface, cros_disks::kUnmount); dbus::MessageWriter writer(&method_call); @@ -176,7 +176,6 @@ class CrosDisksClientImpl : public CrosDisksClient { proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, base::Bind(&CrosDisksClientImpl::OnUnmount, weak_ptr_factory_.GetWeakPtr(), - device_path, callback, error_callback)); } @@ -287,15 +286,14 @@ class CrosDisksClientImpl : public CrosDisksClient { } // Handles the result of Unount and calls |callback| or |error_callback|. - void OnUnmount(const std::string& device_path, - const UnmountCallback& callback, - const UnmountCallback& error_callback, + void OnUnmount(const base::Closure& callback, + const base::Closure& error_callback, dbus::Response* response) { if (!response) { - error_callback.Run(device_path); + error_callback.Run(); return; } - callback.Run(device_path); + callback.Run(); } // Handles the result of EnumerateAutoMountableDevices and calls |callback| or @@ -447,12 +445,11 @@ class CrosDisksClientStubImpl : public CrosDisksClient { virtual void Unmount(const std::string& device_path, UnmountOptions options, - const UnmountCallback& callback, - const UnmountCallback& error_callback) OVERRIDE { + const base::Closure& callback, + const base::Closure& error_callback) OVERRIDE { // Not mounted. if (mounted_to_source_path_map_.count(device_path) == 0) { - base::MessageLoopProxy::current()->PostTask( - FROM_HERE, base::Bind(error_callback, device_path)); + base::MessageLoopProxy::current()->PostTask(FROM_HERE, error_callback); return; } @@ -464,7 +461,7 @@ class CrosDisksClientStubImpl : public CrosDisksClient { base::Bind(base::IgnoreResult(&base::Delete), base::FilePath::FromUTF8Unsafe(device_path), true /* recursive */), - base::Bind(callback, device_path), + callback, true /* task_is_slow */); } diff --git a/chromeos/dbus/cros_disks_client.h b/chromeos/dbus/cros_disks_client.h index 047aeca..d08219e 100644 --- a/chromeos/dbus/cros_disks_client.h +++ b/chromeos/dbus/cros_disks_client.h @@ -198,10 +198,6 @@ class CHROMEOS_EXPORT CrosDisksClient { // A callback to handle the result of Mount. typedef base::Callback<void()> MountCallback; - // A callback to handle the result of Unmount. - // The argument is the device path. - typedef base::Callback<void(const std::string& device_path)> UnmountCallback; - // A callback to handle the result of EnumerateAutoMountableDevices. // The argument is the enumerated device paths. typedef base::Callback<void(const std::vector<std::string>& device_paths) @@ -258,8 +254,8 @@ class CHROMEOS_EXPORT CrosDisksClient { // otherwise, |error_callback| is called. virtual void Unmount(const std::string& device_path, UnmountOptions options, - const UnmountCallback& callback, - const UnmountCallback& error_callback) = 0; + const base::Closure& callback, + const base::Closure& error_callback) = 0; // Calls EnumerateAutoMountableDevices method. |callback| is called after the // method call succeeds, otherwise, |error_callback| is called. diff --git a/chromeos/dbus/fake_cros_disks_client.cc b/chromeos/dbus/fake_cros_disks_client.cc index fe5873d..bd863b8 100644 --- a/chromeos/dbus/fake_cros_disks_client.cc +++ b/chromeos/dbus/fake_cros_disks_client.cc @@ -28,8 +28,8 @@ void FakeCrosDisksClient::Mount(const std::string& source_path, void FakeCrosDisksClient::Unmount(const std::string& device_path, UnmountOptions options, - const UnmountCallback& callback, - const UnmountCallback& error_callback) { + const base::Closure& callback, + const base::Closure& error_callback) { DCHECK(!callback.is_null()); DCHECK(!error_callback.is_null()); @@ -37,9 +37,7 @@ void FakeCrosDisksClient::Unmount(const std::string& device_path, last_unmount_device_path_ = device_path; last_unmount_options_ = options; base::MessageLoopProxy::current()->PostTask( - FROM_HERE, - base::Bind(unmount_success_ ? callback : error_callback, - device_path)); + FROM_HERE, unmount_success_ ? callback : error_callback); if(!unmount_listener_.is_null()) unmount_listener_.Run(); } @@ -64,9 +62,7 @@ void FakeCrosDisksClient::FormatDevice(const std::string& device_path, FROM_HERE, base::Bind(callback, device_path, true)); } else { - base::MessageLoopProxy::current()->PostTask( - FROM_HERE, - base::Bind(error_callback)); + base::MessageLoopProxy::current()->PostTask(FROM_HERE, error_callback); } } diff --git a/chromeos/dbus/fake_cros_disks_client.h b/chromeos/dbus/fake_cros_disks_client.h index 75907aa..dac550b 100644 --- a/chromeos/dbus/fake_cros_disks_client.h +++ b/chromeos/dbus/fake_cros_disks_client.h @@ -27,8 +27,8 @@ class FakeCrosDisksClient : public CrosDisksClient { const ErrorCallback& error_callback) OVERRIDE; virtual void Unmount(const std::string& device_path, UnmountOptions options, - const UnmountCallback& callback, - const UnmountCallback& error_callback) OVERRIDE; + const base::Closure& callback, + const base::Closure& error_callback) OVERRIDE; virtual void EnumerateAutoMountableDevices( const EnumerateAutoMountableDevicesCallback& callback, const ErrorCallback& error_callback) OVERRIDE; diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc index 525e1b6..ba928f2 100644 --- a/chromeos/disks/disk_mount_manager.cc +++ b/chromeos/disks/disk_mount_manager.cc @@ -90,11 +90,13 @@ class DiskMountManagerImpl : public DiskMountManager { base::Bind(&DiskMountManagerImpl::OnUnmountPath, weak_ptr_factory_.GetWeakPtr(), callback, - true), + true, + mount_path), base::Bind(&DiskMountManagerImpl::OnUnmountPath, weak_ptr_factory_.GetWeakPtr(), callback, - false)); + false, + mount_path)); } // DiskMountManager override. @@ -173,9 +175,15 @@ class DiskMountManagerImpl : public DiskMountManager { devices_to_unmount[i], UNMOUNT_OPTIONS_NONE, base::Bind(&DiskMountManagerImpl::OnUnmountDeviceRecursively, - weak_ptr_factory_.GetWeakPtr(), cb_data, true), + weak_ptr_factory_.GetWeakPtr(), + cb_data, + true, + devices_to_unmount[i]), base::Bind(&DiskMountManagerImpl::OnUnmountDeviceRecursively, - weak_ptr_factory_.GetWeakPtr(), cb_data, false)); + weak_ptr_factory_.GetWeakPtr(), + cb_data, + false, + devices_to_unmount[i])); } } |