Commit e37faa16 authored by Bailey Berro's avatar Bailey Berro Committed by Commit Bot

Add Remount to SmbProviderClient

This change implements Remount on SmbProviderClient which calls Remount
on the SmbProvider Daemon via D-Bus.

Bug: 757625
Change-Id: I11b419863996e6bba685f14136e54d65db007d0a
Reviewed-on: https://chromium-review.googlesource.com/987199
Commit-Queue: Bailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548165}
parent cc52af28
......@@ -24,6 +24,13 @@ void FakeSmbProviderClient::Mount(const base::FilePath& share_path,
FROM_HERE, base::BindOnce(std::move(callback), smbprovider::ERROR_OK, 1));
}
void FakeSmbProviderClient::Remount(const base::FilePath& share_path,
int32_t mount_id,
StatusCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), smbprovider::ERROR_OK));
}
void FakeSmbProviderClient::Unmount(int32_t mount_id, StatusCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), smbprovider::ERROR_OK));
......
......@@ -20,6 +20,9 @@ class CHROMEOS_EXPORT FakeSmbProviderClient : public SmbProviderClient {
// SmbProviderClient override.
void Mount(const base::FilePath& share_path, MountCallback callback) override;
void Remount(const base::FilePath& share_path,
int32_t mount_id,
StatusCallback callback) override;
void Unmount(int32_t mount_id, StatusCallback callback) override;
void ReadDirectory(int32_t mount_id,
const base::FilePath& directory_path,
......
......@@ -70,6 +70,15 @@ class SmbProviderClientImpl : public SmbProviderClient {
&SmbProviderClientImpl::HandleMountCallback, &callback);
}
void Remount(const base::FilePath& share_path,
int32_t mount_id,
StatusCallback callback) override {
smbprovider::RemountOptionsProto options;
options.set_path(share_path.value());
options.set_mount_id(mount_id);
CallDefaultMethod(smbprovider::kRemountMethod, options, &callback);
}
void Unmount(int32_t mount_id, StatusCallback callback) override {
smbprovider::UnmountOptionsProto options;
options.set_mount_id(mount_id);
......
......@@ -53,6 +53,12 @@ class CHROMEOS_EXPORT SmbProviderClient
virtual void Mount(const base::FilePath& share_path,
MountCallback callback) = 0;
// Calls Remount. This attempts to remount the share at |share_path| with its
// original |mount_id|.
virtual void Remount(const base::FilePath& share_path,
int32_t mount_id,
StatusCallback callback) = 0;
// Calls Unmount. This removes the corresponding mount of |mount_id| from
// the list of valid mounts. Subsequent operations on |mount_id| will fail.
virtual void Unmount(int32_t mount_id, StatusCallback callback) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment