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

Unified Diff: chrome/browser/chromeos/file_manager/volume_manager.cc

Issue 2201023002: Change access mode of disk devices when mounting based on config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. 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
Index: chrome/browser/chromeos/file_manager/volume_manager.cc
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc
index ab8f81508e32904a48ae11ebc96b58bb7709956f..01991a06714eebdf329c9069d350e1a040cfec11 100644
--- a/chrome/browser/chromeos/file_manager/volume_manager.cc
+++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -135,6 +135,12 @@ std::string GetMountPointNameForMediaStorage(
return name;
}
+chromeos::MountAccessMode GetExternalStorageAccessMode(const Profile* profile) {
+ return profile->GetPrefs()->GetBoolean(prefs::kExternalStorageReadOnly)
+ ? chromeos::MOUNT_ACCESS_MODE_READ_ONLY
+ : chromeos::MOUNT_ACCESS_MODE_READ_WRITE;
+}
+
} // namespace
Volume::Volume()
@@ -494,9 +500,10 @@ void VolumeManager::OnDiskEvent(
// Initiate disk mount operation. MountPath auto-detects the filesystem
// format if the second argument is empty. The third argument (mount
// label) is not used in a disk mount operation.
- disk_mount_manager_->MountPath(
- disk->device_path(), std::string(), std::string(),
- chromeos::MOUNT_TYPE_DEVICE);
+ disk_mount_manager_->MountPath(disk->device_path(), std::string(),
+ std::string(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ GetExternalStorageAccessMode(profile_));
mounting = true;
}
@@ -609,9 +616,10 @@ void VolumeManager::OnFormatEvent(
// MountPath auto-detects filesystem format if second argument is
// empty. The third argument (mount label) is not used in a disk mount
// operation.
- disk_mount_manager_->MountPath(
- device_path, std::string(), std::string(),
- chromeos::MOUNT_TYPE_DEVICE);
+ disk_mount_manager_->MountPath(device_path, std::string(),
+ std::string(),
+ chromeos::MOUNT_TYPE_DEVICE,
+ GetExternalStorageAccessMode(profile_));
}
FOR_EACH_OBSERVER(

Powered by Google App Engine
This is Rietveld 408576698