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

Side by Side Diff: chromeos/dbus/cros_disks_client.h

Issue 2392503002: Allow to pass remount option to Mount method of cros_disks_client. (Closed)
Patch Set: Describe RemountOption in more detail in the comment. Created 4 years, 2 months 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
« no previous file with comments | « no previous file | chromeos/dbus/cros_disks_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DBUS_CROS_DISKS_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
6 #define CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_ 6 #define CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 UNMOUNT_OPTIONS_NONE, 101 UNMOUNT_OPTIONS_NONE,
102 UNMOUNT_OPTIONS_LAZY, // Do lazy unmount. 102 UNMOUNT_OPTIONS_LAZY, // Do lazy unmount.
103 }; 103 };
104 104
105 // Mount option to control write permission to a device. 105 // Mount option to control write permission to a device.
106 enum MountAccessMode { 106 enum MountAccessMode {
107 MOUNT_ACCESS_MODE_READ_WRITE, 107 MOUNT_ACCESS_MODE_READ_WRITE,
108 MOUNT_ACCESS_MODE_READ_ONLY, 108 MOUNT_ACCESS_MODE_READ_ONLY,
109 }; 109 };
110 110
111 // Whether to mount to a new path or remount a device already mounted.
112 enum RemountOption {
113 // Mount a new device. If the device is already mounted, the mount status is
114 // unchanged and the callback for MountCompleted will receive
115 // MOUNT_ERROR_PATH_ALREADY_MOUNTED error code.
116 REMOUNT_OPTION_DISABLED,
117 // Remount a device that is already mounted. If the device is not mounted
118 // yet, it will do nothing and the callback for MountCompleted will receive
119 // MOUNT_ERROR_PATH_ALREADY_MOUNTED error code.
hashimoto 2016/10/19 12:15:27 Receiving MOUNT_ERROR_PATH_ALREADY_MOUNTED when no
yamaguchi 2016/10/19 12:27:21 It was a simple mistake of the comment. Thanks.
120 REMOUNT_OPTION_ENABLED,
121 };
122
111 // A class to represent information about a disk sent from cros-disks. 123 // A class to represent information about a disk sent from cros-disks.
112 class CHROMEOS_EXPORT DiskInfo { 124 class CHROMEOS_EXPORT DiskInfo {
113 public: 125 public:
114 DiskInfo(const std::string& device_path, dbus::Response* response); 126 DiskInfo(const std::string& device_path, dbus::Response* response);
115 ~DiskInfo(); 127 ~DiskInfo();
116 128
117 // Device path. (e.g. /sys/devices/pci0000:00/.../8:0:0:0/block/sdb/sdb1) 129 // Device path. (e.g. /sys/devices/pci0000:00/.../8:0:0:0/block/sdb/sdb1)
118 const std::string& device_path() const { return device_path_; } 130 const std::string& device_path() const { return device_path_; }
119 131
120 // Disk mount path. (e.g. /media/removable/VOLUME) 132 // Disk mount path. (e.g. /media/removable/VOLUME)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // - The |source_format| argument passes the file extension (with the leading 283 // - The |source_format| argument passes the file extension (with the leading
272 // dot, for example ".zip"). If |source_format| is empty then the source 284 // dot, for example ".zip"). If |source_format| is empty then the source
273 // format is auto-detected. 285 // format is auto-detected.
274 // - The |mount_label| argument passes an optional mount label to be used as 286 // - The |mount_label| argument passes an optional mount label to be used as
275 // the directory name of the mount point. If |mount_label| is empty, the 287 // the directory name of the mount point. If |mount_label| is empty, the
276 // mount label will be based on the |source_path|. 288 // mount label will be based on the |source_path|.
277 virtual void Mount(const std::string& source_path, 289 virtual void Mount(const std::string& source_path,
278 const std::string& source_format, 290 const std::string& source_format,
279 const std::string& mount_label, 291 const std::string& mount_label,
280 MountAccessMode access_mode, 292 MountAccessMode access_mode,
293 RemountOption remount,
281 const base::Closure& callback, 294 const base::Closure& callback,
282 const base::Closure& error_callback) = 0; 295 const base::Closure& error_callback) = 0;
283 296
284 // Calls Unmount method. |callback| is called after the method call succeeds, 297 // Calls Unmount method. |callback| is called after the method call succeeds,
285 // otherwise, |error_callback| is called. 298 // otherwise, |error_callback| is called.
286 virtual void Unmount(const std::string& device_path, 299 virtual void Unmount(const std::string& device_path,
287 UnmountOptions options, 300 UnmountOptions options,
288 const base::Closure& callback, 301 const base::Closure& callback,
289 const base::Closure& error_callback) = 0; 302 const base::Closure& error_callback) = 0;
290 303
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 347
335 // Returns the path of the mount point for archive files. 348 // Returns the path of the mount point for archive files.
336 static base::FilePath GetArchiveMountPoint(); 349 static base::FilePath GetArchiveMountPoint();
337 350
338 // Returns the path of the mount point for removable disks. 351 // Returns the path of the mount point for removable disks.
339 static base::FilePath GetRemovableDiskMountPoint(); 352 static base::FilePath GetRemovableDiskMountPoint();
340 353
341 // Composes a list of mount options. 354 // Composes a list of mount options.
342 static std::vector<std::string> ComposeMountOptions( 355 static std::vector<std::string> ComposeMountOptions(
343 const std::string& mount_label, 356 const std::string& mount_label,
344 MountAccessMode access_mode); 357 MountAccessMode access_mode,
358 RemountOption remount);
345 359
346 protected: 360 protected:
347 // Create() should be used instead. 361 // Create() should be used instead.
348 CrosDisksClient(); 362 CrosDisksClient();
349 363
350 private: 364 private:
351 DISALLOW_COPY_AND_ASSIGN(CrosDisksClient); 365 DISALLOW_COPY_AND_ASSIGN(CrosDisksClient);
352 }; 366 };
353 367
354 } // namespace chromeos 368 } // namespace chromeos
355 369
356 #endif // CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_ 370 #endif // CHROMEOS_DBUS_CROS_DISKS_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/cros_disks_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698