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

Unified Diff: chromeos/dbus/fake_cros_disks_client.cc

Issue 2230713003: Store correct read-only flag of mounted disks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test to make sure observers can see updated disks. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/disks/disk_mount_manager.h » ('j') | chromeos/disks/disk_mount_manager_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_cros_disks_client.cc
diff --git a/chromeos/dbus/fake_cros_disks_client.cc b/chromeos/dbus/fake_cros_disks_client.cc
index 62fcd5cc2584938c10f0ea6896a22379c440189d..4323a81bcd9505e1706acbe4e7d0f7628c1e004d 100644
--- a/chromeos/dbus/fake_cros_disks_client.cc
+++ b/chromeos/dbus/fake_cros_disks_client.cc
@@ -82,11 +82,25 @@ void FakeCrosDisksClient::Mount(const std::string& source_path,
MountAccessMode access_mode,
const base::Closure& callback,
const base::Closure& error_callback) {
- // This fake implementation only accepts archive mount requests.
- const MountType type = MOUNT_TYPE_ARCHIVE;
-
- const base::FilePath mounted_path = GetArchiveMountPoint().Append(
- base::FilePath::FromUTF8Unsafe(mount_label));
+ // This fake implementation assumes mounted path is device when source_format
+ // is empty, or an archive otherwise.
+ MountType type =
+ (source_format == "") ? MOUNT_TYPE_DEVICE : MOUNT_TYPE_ARCHIVE;
+
+ base::FilePath mounted_path;
+ switch (type) {
+ case MOUNT_TYPE_ARCHIVE:
+ mounted_path = GetArchiveMountPoint().Append(
+ base::FilePath::FromUTF8Unsafe(mount_label));
+ break;
+ case MOUNT_TYPE_DEVICE:
+ mounted_path = GetRemovableDiskMountPoint().Append(
+ base::FilePath::FromUTF8Unsafe(mount_label));
+ break;
+ case MOUNT_TYPE_INVALID:
+ // Unreachable
+ return;
+ }
mounted_paths_.insert(mounted_path);
base::PostTaskAndReplyWithResult(
« no previous file with comments | « no previous file | chromeos/disks/disk_mount_manager.h » ('j') | chromeos/disks/disk_mount_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698