Chromium Code Reviews| 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..21d11ffaeb82ca44befe5bda821313063eb5706c 100644 |
| --- a/chrome/browser/chromeos/file_manager/volume_manager.cc |
| +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc |
| @@ -135,6 +135,15 @@ std::string GetMountPointNameForMediaStorage( |
| return name; |
| } |
| +chromeos::MountAccessMode GetExternalStorageAccessMode(const Profile* profile) { |
| + bool read_only = |
| + profile->GetPrefs()->HasPrefPath(prefs::kExternalStorageReadOnly) |
|
yamaguchi
2016/08/05 06:14:44
Reverted this check in Patch Set 8 because Has*()
|
| + ? profile->GetPrefs()->GetBoolean(prefs::kExternalStorageReadOnly) |
| + : false; |
| + return read_only ? chromeos::MOUNT_ACCESS_MODE_READ_ONLY |
| + : chromeos::MOUNT_ACCESS_MODE_READ_WRITE; |
| +} |
| + |
| } // namespace |
| Volume::Volume() |
| @@ -494,9 +503,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 +619,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( |