Chromium Code Reviews| Index: chromeos/disks/disk_mount_manager.h |
| diff --git a/chromeos/disks/disk_mount_manager.h b/chromeos/disks/disk_mount_manager.h |
| index 0fb0af4cf8041527c256ac8e7b8653a0bfb0e3a1..b97ca0d2668ca89ddbea99e0ee38d5f989036500 100644 |
| --- a/chromeos/disks/disk_mount_manager.h |
| +++ b/chromeos/disks/disk_mount_manager.h |
| @@ -56,6 +56,7 @@ class CHROMEOS_EXPORT DiskMountManager { |
| public: |
| Disk(const std::string& device_path, |
| const std::string& mount_path, |
| + bool write_disabled_by_policy, |
| const std::string& system_path, |
| const std::string& file_path, |
| const std::string& device_label, |
| @@ -69,7 +70,7 @@ class CHROMEOS_EXPORT DiskMountManager { |
| DeviceType device_type, |
| uint64_t total_size_in_bytes, |
| bool is_parent, |
| - bool is_read_only, |
| + bool is_read_only_hardware, |
| bool has_media, |
| bool on_boot_device, |
| bool on_removable_device, |
| @@ -83,7 +84,7 @@ class CHROMEOS_EXPORT DiskMountManager { |
| // The path to the mount point of this device. Will be empty if not mounted. |
| // (e.g. /media/removable/VOLUME) |
| - const std::string& mount_path() const { return mount_path_; } |
| + const std::string& mount_path() const { return mount_path_; } |
| // The path of the device according to the udev system. |
| // (e.g. /sys/devices/pci0000:00/.../8:0:0:0/block/sdb/sdb1) |
| @@ -130,8 +131,13 @@ class CHROMEOS_EXPORT DiskMountManager { |
| // Is the device is a parent device (i.e. sdb rather than sdb1). |
| bool is_parent() const { return is_parent_; } |
| + // Whether the user can write to the device. True if read-only. |
| + bool is_read_only() const { |
| + return is_read_only_hardware_ || write_disabled_by_policy_; |
| + } |
| + |
| // Is the device read only. |
| - bool is_read_only() const { return is_read_only_; } |
| + bool is_read_only_hardware() const { return is_read_only_hardware_; } |
| // Does the device contains media. |
| bool has_media() const { return has_media_; } |
| @@ -149,13 +155,21 @@ class CHROMEOS_EXPORT DiskMountManager { |
| mount_path_ = mount_path; |
| } |
| - void set_read_only(bool is_read_only) { is_read_only_ = is_read_only; } |
| + void set_write_disabled_by_policy(bool disable) { |
| + write_disabled_by_policy_ = disable; |
| + } |
| void clear_mount_path() { mount_path_.clear(); } |
| private: |
| std::string device_path_; |
| + |
| + // The path to the mount point of this device. Will be empty if not mounted. |
| + // (e.g. /media/removable/VOLUME) |
| std::string mount_path_; |
| + // Whether the device is mounted in read-only mode because of the policy. |
| + // Valid only when the device mounted and mount_path_ is non-empty. |
| + bool write_disabled_by_policy_; |
|
satorux1
2016/10/24 05:07:57
Maybe move these comments to the constructor? I th
yamaguchi
2016/10/24 07:01:06
Done.
|
| std::string system_path_; |
| std::string file_path_; |
| std::string device_label_; |
| @@ -169,7 +183,7 @@ class CHROMEOS_EXPORT DiskMountManager { |
| DeviceType device_type_; |
| uint64_t total_size_in_bytes_; |
| bool is_parent_; |
| - bool is_read_only_; |
| + bool is_read_only_hardware_; |
| bool has_media_; |
| bool on_boot_device_; |
| bool on_removable_device_; |