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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « disk.h ('k') | disks_testrunner.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) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 #include "disk.h" 5 #include "disk.h"
6 6
7 namespace cros_disks { 7 namespace cros_disks {
8 8
9 // Keys that libcros expects to see on the wire. 9 // Keys that libcros expects to see on the wire.
10 // TODO(rtc): We should probably stuff these in a shared header... 10 // TODO(rtc): We should probably stuff these in a shared header...
11 const char kDeviceIsDrive[] = "DeviceIsDrive"; 11 const char kDeviceIsDrive[] = "DeviceIsDrive";
12 const char kDevicePresentationHide[] = "DevicePresentationHide"; 12 const char kDevicePresentationHide[] = "DevicePresentationHide";
13 const char kDeviceIsMounted[] = "DeviceIsMounted"; 13 const char kDeviceIsMounted[] = "DeviceIsMounted";
14 const char kDeviceMountPaths[] = "DeviceMountPaths"; 14 const char kDeviceMountPaths[] = "DeviceMountPaths";
15 const char kDeviceIsMediaAvailable[] = "DeviceIsMediaAvailable"; 15 const char kDeviceIsMediaAvailable[] = "DeviceIsMediaAvailable";
16 const char kNativePath[] = "NativePath"; 16 const char kNativePath[] = "NativePath";
17 const char kDeviceFile[] = "DeviceFile"; 17 const char kDeviceFile[] = "DeviceFile";
18 const char kLabel[] = "IdLabel"; 18 const char kLabel[] = "IdLabel";
19 const char kDriveModel[] = "DriveModel"; 19 const char kDriveModel[] = "DriveModel";
20 const char kPartitionSlave[] = "PartitionSlave";
21 const char kDriveIsRotational[] = "DriveIsRotational"; 20 const char kDriveIsRotational[] = "DriveIsRotational";
22 const char kDeviceIsOpticalDisc[] = "DeviceIsOpticalDisc"; 21 const char kDeviceIsOpticalDisc[] = "DeviceIsOpticalDisc";
23 const char kDeviceSize[] = "DeviceSize"; 22 const char kDeviceSize[] = "DeviceSize";
24 const char kReadOnly[] = "DeviceIsReadOnly"; 23 const char kReadOnly[] = "DeviceIsReadOnly";
25 24
25 // TODO(rtc): Figure out what this field is and include it in the response.
26 const char kPartitionSlave[] = "PartitionSlave";
26 27
27 // TODO(rtc): The constructor should set some defaults, but I'm still iterating 28 // TODO(rtc): The constructor should set some defaults, but I'm still iterating
28 // on the data model. 29 // on the data model.
29 Disk::Disk() { 30 Disk::Disk() {
30 } 31 }
31 32
32 Disk::~Disk() { 33 Disk::~Disk() {
33 } 34 }
34 35
36 DBusDisk Disk::ToDBusFormat() const {
37 DBusDisk disk;
38 disk[kDeviceIsDrive].writer().append_bool(is_drive());
39 disk[kDevicePresentationHide].writer().append_bool(is_hidden());
40 disk[kDeviceIsMounted].writer().append_bool(is_mounted());
41 disk[kDeviceMountPaths].writer().append_string(mount_path().c_str());
42 disk[kDeviceIsMediaAvailable].writer().append_bool(is_media_available());
43 disk[kNativePath].writer().append_string(native_path().c_str());
44 disk[kDeviceFile].writer().append_string(device_file().c_str());
45 disk[kLabel].writer().append_string(label().c_str());
46 disk[kDriveModel].writer().append_string(drive_model().c_str());
47 disk[kDriveIsRotational].writer().append_bool(is_rotational());
48 disk[kDeviceIsOpticalDisc].writer().append_bool(is_optical_disk());
49 disk[kDeviceSize].writer().append_int64(device_capacity());
50 disk[kReadOnly].writer().append_bool(is_read_only());
51 return disk;
52 }
53
35 } // namespace cros_disks 54 } // namespace cros_disks
OLDNEW
« 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