Chromium Code Reviews| Index: chrome/browser/storage_monitor/volume_mount_watcher_win.cc |
| diff --git a/chrome/browser/storage_monitor/volume_mount_watcher_win.cc b/chrome/browser/storage_monitor/volume_mount_watcher_win.cc |
| index 3c7a9d3930370249c99e3de344b7a5fef0265691..f862246a2e0cf0ce4866ea2c9220632a9d558b15 100644 |
| --- a/chrome/browser/storage_monitor/volume_mount_watcher_win.cc |
| +++ b/chrome/browser/storage_monitor/volume_mount_watcher_win.cc |
| @@ -22,9 +22,15 @@ namespace { |
| const DWORD kMaxPathBufLen = MAX_PATH + 1; |
| -bool IsRemovable(const string16& mount_point) { |
| +enum DeviceType { |
| + FLOPPY, |
| + REMOVABLE, |
| + FIXED |
|
vandebo (ex-Chrome)
2013/03/06 01:49:08
nit: add , at end so that future additions don't h
Greg Billock
2013/03/06 18:33:24
Done.
|
| +}; |
| + |
| +DeviceType GetDeviceType(const string16& mount_point) { |
| if (GetDriveType(mount_point.c_str()) != DRIVE_REMOVABLE) |
| - return false; |
| + return FIXED; |
| // We don't consider floppy disks as removable, so check for that. |
| string16 device = mount_point; |
| @@ -33,8 +39,8 @@ bool IsRemovable(const string16& mount_point) { |
| string16 device_path; |
| if (!QueryDosDevice(device.c_str(), WriteInto(&device_path, kMaxPathBufLen), |
| kMaxPathBufLen)) |
| - return true; |
| - return device_path.find(L"Floppy") == string16::npos; |
| + return REMOVABLE; |
| + return device_path.find(L"Floppy") == string16::npos ? REMOVABLE : FLOPPY; |
| } |
| // Returns 0 if the devicetype is not volume. |
| @@ -81,12 +87,18 @@ bool GetDeviceDetails(const base::FilePath& device_path, |
| return false; |
| } |
| + DeviceType device_type = GetDeviceType(mount_point); |
| if (removable) |
| - *removable = IsRemovable(mount_point); |
| + *removable = (device_type == REMOVABLE); |
| if (device_location) |
| *device_location = mount_point; |
| + // If we're adding a floppy drive, return without querying any more |
| + // drive metadata -- it will cause the floppy drive to seek. |
| + if (device_type == FLOPPY) |
| + return true; |
| + |
| if (volume_size) |
| *volume_size = GetVolumeSize(mount_point); |
| @@ -140,7 +152,7 @@ std::vector<base::FilePath> GetAttachedDevices() { |
| if (GetVolumePathNamesForVolumeName(volume_name.c_str(), |
| WriteInto(&volume_path, kMaxPathBufLen), |
| kMaxPathBufLen, &return_count)) { |
| - if (IsRemovable(volume_path)) |
| + if (GetDeviceType(volume_path) == REMOVABLE) |
|
vandebo (ex-Chrome)
2013/03/06 01:49:08
Actually I'm not sure we want this at all. If we
Greg Billock
2013/03/06 18:33:24
That makes sense. Let's get rid of it. Although wi
|
| result.push_back(base::FilePath(volume_path)); |
| } else { |
| DPLOG(ERROR); |