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

Side by Side Diff: chromeos/disks/disk_mount_manager.h

Issue 2451603002: Add a method to remount all removable devices in DiskMountManager. (Closed)
Patch Set: Add is_mounted() method. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 5 #ifndef CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
6 #define CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 6 #define CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void set_mount_path(const std::string& mount_path) { 158 void set_mount_path(const std::string& mount_path) {
159 mount_path_ = mount_path; 159 mount_path_ = mount_path;
160 } 160 }
161 161
162 void set_write_disabled_by_policy(bool disable) { 162 void set_write_disabled_by_policy(bool disable) {
163 write_disabled_by_policy_ = disable; 163 write_disabled_by_policy_ = disable;
164 } 164 }
165 165
166 void clear_mount_path() { mount_path_.clear(); } 166 void clear_mount_path() { mount_path_.clear(); }
167 167
168 bool is_mounted() const { return !mount_path_.empty(); }
169
168 private: 170 private:
169 std::string device_path_; 171 std::string device_path_;
170 std::string mount_path_; 172 std::string mount_path_;
171 bool write_disabled_by_policy_; 173 bool write_disabled_by_policy_;
172 std::string system_path_; 174 std::string system_path_;
173 std::string file_path_; 175 std::string file_path_;
174 std::string device_label_; 176 std::string device_label_;
175 std::string drive_label_; 177 std::string drive_label_;
176 std::string vendor_id_; 178 std::string vendor_id_;
177 std::string vendor_name_; 179 std::string vendor_name_;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Unmounts a mounted disk. 289 // Unmounts a mounted disk.
288 // |UnmountOptions| enum defined in chromeos/dbus/cros_disks_client.h. 290 // |UnmountOptions| enum defined in chromeos/dbus/cros_disks_client.h.
289 // When the method is complete, |callback| will be called and observers' 291 // When the method is complete, |callback| will be called and observers'
290 // |OnMountEvent| will be raised. 292 // |OnMountEvent| will be raised.
291 // 293 //
292 // |callback| may be empty, in which case it gets ignored. 294 // |callback| may be empty, in which case it gets ignored.
293 virtual void UnmountPath(const std::string& mount_path, 295 virtual void UnmountPath(const std::string& mount_path,
294 UnmountOptions options, 296 UnmountOptions options,
295 const UnmountPathCallback& callback) = 0; 297 const UnmountPathCallback& callback) = 0;
296 298
299 // Remounts mounted removable devices to change the read-only mount option.
300 // Devices that can be mounted only in its read-only mode will be ignored.
301 virtual void RemountAllRemovableDrives(chromeos::MountAccessMode mode) = 0;
302
297 // Formats Device given its mount path. Unmounts the device. 303 // Formats Device given its mount path. Unmounts the device.
298 // Example: mount_path: /media/VOLUME_LABEL 304 // Example: mount_path: /media/VOLUME_LABEL
299 virtual void FormatMountedDevice(const std::string& mount_path) = 0; 305 virtual void FormatMountedDevice(const std::string& mount_path) = 0;
300 306
301 // Unmounts device_path and all of its known children. 307 // Unmounts device_path and all of its known children.
302 virtual void UnmountDeviceRecursively( 308 virtual void UnmountDeviceRecursively(
303 const std::string& device_path, 309 const std::string& device_path,
304 const UnmountDeviceRecursivelyCallbackType& callback) = 0; 310 const UnmountDeviceRecursivelyCallbackType& callback) = 0;
305 311
306 // Used in tests to initialize the manager's disk and mount point sets. 312 // Used in tests to initialize the manager's disk and mount point sets.
(...skipping 21 matching lines...) Expand all
328 334
329 // Returns a pointer to the global DiskMountManager instance. 335 // Returns a pointer to the global DiskMountManager instance.
330 // Initialize() should already have been called. 336 // Initialize() should already have been called.
331 static DiskMountManager* GetInstance(); 337 static DiskMountManager* GetInstance();
332 }; 338 };
333 339
334 } // namespace disks 340 } // namespace disks
335 } // namespace chromeos 341 } // namespace chromeos
336 342
337 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_ 343 #endif // CHROMEOS_DISKS_DISK_MOUNT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc ('k') | chromeos/disks/disk_mount_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698