diff options
author | tbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-19 07:17:28 +0000 |
---|---|---|
committer | tbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-19 07:17:28 +0000 |
commit | ddcb18ee3d5b783de53a83f94447bf1d72dc683d (patch) | |
tree | 0f3e92330da6bb5e3f4baf6bc71377b74159d0a5 /chromeos | |
parent | ffe5f04a17191bc87e448fa4f35bce5755d5061d (diff) | |
download | chromium_src-ddcb18ee3d5b783de53a83f94447bf1d72dc683d.zip chromium_src-ddcb18ee3d5b783de53a83f94447bf1d72dc683d.tar.gz chromium_src-ddcb18ee3d5b783de53a83f94447bf1d72dc683d.tar.bz2 |
Update cros_disks_client to work with Unmount method returning status.
...in addition to Unmount method that sets dbus error on failure.
This is in preparation of changing Unmount method to return mount
status on cros-disks side.
BUG=288974
TEST=try unmounting a device both while it's busy and idle.
In the first case, unmount fails and a warningis shown.
In the second case, the device is successfully unmounted.
Review URL: https://chromiumcodereview.appspot.com/23684051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224073 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/cros_disks_client.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc index 7233786..4f52483 100644 --- a/chromeos/dbus/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks_client.cc @@ -252,6 +252,23 @@ class CrosDisksClientImpl : public CrosDisksClient { error_callback.Run(); return; } + + // Temporarly allow Unmount method to report failure both by setting dbus + // error (in which case response is not set) and by returning mount error + // different from MOUNT_ERROR_NONE. This is done so we can change Unmount + // method to return mount error (http://crbug.com/288974) without breaking + // Chrome. + // TODO(tbarzic): When Unmount implementation is changed on cros disks side, + // make this fail if reader is not able to read the error code value from + // the response. + dbus::MessageReader reader(response); + unsigned int error_code; + if (reader.PopUint32(&error_code) && + static_cast<MountError>(error_code) != MOUNT_ERROR_NONE) { + error_callback.Run(); + return; + } + callback.Run(); } |