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..ab3c3b187d2c1d62259cb8dcbd3698a0cf4dbe1e 100644 |
| --- a/chrome/browser/chromeos/file_manager/volume_manager.cc |
| +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc |
| @@ -135,6 +135,13 @@ std::string GetMountPointNameForMediaStorage( |
| return name; |
| } |
| +chromeos::MountAccessMode GetExternalStorageAccessMode(const Profile* profile) { |
| + bool read_only = |
| + profile->GetPrefs()->GetBoolean(prefs::kExternalStorageReadOnly); |
|
yamaguchi
2016/08/04 09:43:31
GetBoolean returns false when the value did not ex
|
| + return read_only ? chromeos::MOUNT_ACCESS_MODE_READ_ONLY |
| + : chromeos::MOUNT_ACCESS_MODE_READ_WRITE; |
| +} |
| + |
| } // namespace |
| Volume::Volume() |
| @@ -494,9 +501,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 +617,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( |