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

Unified Diff: disk.cc

Issue 6838011: adds a signal, fixes a crash, adds syslogging, and marshals disks to d-bus (Closed) Base URL: ssh://gitrw.chromium.org:9222/cros-disks.git@master
Patch Set: addresses code review comments Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « disk.h ('k') | disks_testrunner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: disk.cc
diff --git a/disk.cc b/disk.cc
index fe0bf8c33ac49c4e334147f7f207cfeb0cfb65df..0300be66f5b4bcc04f3402b7d12de02fafb0ea45 100644
--- a/disk.cc
+++ b/disk.cc
@@ -17,12 +17,13 @@ const char kNativePath[] = "NativePath";
const char kDeviceFile[] = "DeviceFile";
const char kLabel[] = "IdLabel";
const char kDriveModel[] = "DriveModel";
-const char kPartitionSlave[] = "PartitionSlave";
const char kDriveIsRotational[] = "DriveIsRotational";
const char kDeviceIsOpticalDisc[] = "DeviceIsOpticalDisc";
const char kDeviceSize[] = "DeviceSize";
const char kReadOnly[] = "DeviceIsReadOnly";
+// TODO(rtc): Figure out what this field is and include it in the response.
+const char kPartitionSlave[] = "PartitionSlave";
// TODO(rtc): The constructor should set some defaults, but I'm still iterating
// on the data model.
@@ -32,4 +33,22 @@ Disk::Disk() {
Disk::~Disk() {
}
+DBusDisk Disk::ToDBusFormat() const {
+ DBusDisk disk;
+ disk[kDeviceIsDrive].writer().append_bool(is_drive());
+ disk[kDevicePresentationHide].writer().append_bool(is_hidden());
+ disk[kDeviceIsMounted].writer().append_bool(is_mounted());
+ disk[kDeviceMountPaths].writer().append_string(mount_path().c_str());
+ disk[kDeviceIsMediaAvailable].writer().append_bool(is_media_available());
+ disk[kNativePath].writer().append_string(native_path().c_str());
+ disk[kDeviceFile].writer().append_string(device_file().c_str());
+ disk[kLabel].writer().append_string(label().c_str());
+ disk[kDriveModel].writer().append_string(drive_model().c_str());
+ disk[kDriveIsRotational].writer().append_bool(is_rotational());
+ disk[kDeviceIsOpticalDisc].writer().append_bool(is_optical_disk());
+ disk[kDeviceSize].writer().append_int64(device_capacity());
+ disk[kReadOnly].writer().append_bool(is_read_only());
+ return disk;
+}
+
} // namespace cros_disks
« no previous file with comments | « disk.h ('k') | disks_testrunner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698