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

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager.h

Issue 2451713002: Propagate the read_only_hardware flag of volumes to js. (Closed)
Patch Set: Rename the field name to is_read_only_removable_device, as it's only valid for removable devices. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const base::FilePath& mount_path() const { return mount_path_; } 109 const base::FilePath& mount_path() const { return mount_path_; }
110 chromeos::disks::MountCondition mount_condition() const { 110 chromeos::disks::MountCondition mount_condition() const {
111 return mount_condition_; 111 return mount_condition_;
112 } 112 }
113 MountContext mount_context() const { return mount_context_; } 113 MountContext mount_context() const { return mount_context_; }
114 const base::FilePath& system_path_prefix() const { 114 const base::FilePath& system_path_prefix() const {
115 return system_path_prefix_; 115 return system_path_prefix_;
116 } 116 }
117 const std::string& volume_label() const { return volume_label_; } 117 const std::string& volume_label() const { return volume_label_; }
118 bool is_parent() const { return is_parent_; } 118 bool is_parent() const { return is_parent_; }
119 // Whether the applications can write to the volume. True if not writable.
120 // For example, when write access to external storage is restricted by the
121 // policy (ExternalStorageReadOnly), is_read_only() will be true even when
122 // is_read_only_removable_device() is false.
119 bool is_read_only() const { return is_read_only_; } 123 bool is_read_only() const { return is_read_only_; }
124 // Whether the device is write-protected by hardware. This field is valid
125 // only when device_type is VOLUME_TYPE_REMOVABLE_DISK_PARTITION and
126 // source is SOURCE_DEVICE.
127 // When this value is true, is_read_only() is also true.
128 bool is_read_only_removable_device() const {
129 return is_read_only_removable_device_;
130 }
120 bool has_media() const { return has_media_; } 131 bool has_media() const { return has_media_; }
121 bool configurable() const { return configurable_; } 132 bool configurable() const { return configurable_; }
122 bool watchable() const { return watchable_; } 133 bool watchable() const { return watchable_; }
123 134
124 private: 135 private:
125 Volume(); 136 Volume();
126 137
127 // The ID of the volume. 138 // The ID of the volume.
128 std::string volume_id_; 139 std::string volume_id_;
129 140
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::FilePath system_path_prefix_; 179 base::FilePath system_path_prefix_;
169 180
170 // Label for the volume if the volume is either removable or a provided 181 // Label for the volume if the volume is either removable or a provided
171 // file system. In case of removables, if disk is a parent, then its label, 182 // file system. In case of removables, if disk is a parent, then its label,
172 // else parents label (e.g. "TransMemory"). 183 // else parents label (e.g. "TransMemory").
173 std::string volume_label_; 184 std::string volume_label_;
174 185
175 // Is the device is a parent device (i.e. sdb rather than sdb1). 186 // Is the device is a parent device (i.e. sdb rather than sdb1).
176 bool is_parent_; 187 bool is_parent_;
177 188
178 // True if the volume is read only. 189 // True if the volume is not writable by applications.
179 bool is_read_only_; 190 bool is_read_only_;
180 191
192 // True if the volume is made read_only due to its hardware.
193 // This implies is_read_only_.
194 bool is_read_only_removable_device_;
195
181 // True if the volume contains media. 196 // True if the volume contains media.
182 bool has_media_; 197 bool has_media_;
183 198
184 // True if the volume is configurable. 199 // True if the volume is configurable.
185 bool configurable_; 200 bool configurable_;
186 201
187 // True if the volume notifies about changes via file/directory watchers. 202 // True if the volume notifies about changes via file/directory watchers.
188 bool watchable_; 203 bool watchable_;
189 204
190 DISALLOW_COPY_AND_ASSIGN(Volume); 205 DISALLOW_COPY_AND_ASSIGN(Volume);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 332
318 // Note: This should remain the last member so it'll be destroyed and 333 // Note: This should remain the last member so it'll be destroyed and
319 // invalidate its weak pointers before any other members are destroyed. 334 // invalidate its weak pointers before any other members are destroyed.
320 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_; 335 base::WeakPtrFactory<VolumeManager> weak_ptr_factory_;
321 DISALLOW_COPY_AND_ASSIGN(VolumeManager); 336 DISALLOW_COPY_AND_ASSIGN(VolumeManager);
322 }; 337 };
323 338
324 } // namespace file_manager 339 } // namespace file_manager
325 340
326 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_ 341 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698