| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/storage_monitor/volume_mount_watcher_win.h" | 5 #include "components/storage_monitor/volume_mount_watcher_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <dbt.h> | 9 #include <dbt.h> |
| 10 #include <fileapi.h> | 10 #include <fileapi.h> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 GetVolumeInformationW(device_path.value().c_str(), | 167 GetVolumeInformationW(device_path.value().c_str(), |
| 168 WriteInto(&volume_label, kMaxPathBufLen), | 168 WriteInto(&volume_label, kMaxPathBufLen), |
| 169 kMaxPathBufLen, NULL, NULL, NULL, NULL, 0); | 169 kMaxPathBufLen, NULL, NULL, NULL, NULL, 0); |
| 170 | 170 |
| 171 uint64 total_size_in_bytes = GetVolumeSize(mount_point); | 171 uint64 total_size_in_bytes = GetVolumeSize(mount_point); |
| 172 std::string device_id = | 172 std::string device_id = |
| 173 StorageInfo::MakeDeviceId(type, base::UTF16ToUTF8(guid)); | 173 StorageInfo::MakeDeviceId(type, base::UTF16ToUTF8(guid)); |
| 174 | 174 |
| 175 // TODO(gbillock): if volume_label.empty(), get the vendor/model information | 175 // TODO(gbillock): if volume_label.empty(), get the vendor/model information |
| 176 // for the volume. | 176 // for the volume. |
| 177 *info = StorageInfo(device_id, base::string16(), mount_point, | 177 *info = StorageInfo(device_id, mount_point, volume_label, base::string16(), |
| 178 volume_label, base::string16(), base::string16(), | 178 base::string16(), total_size_in_bytes); |
| 179 total_size_in_bytes); | |
| 180 return true; | 179 return true; |
| 181 } | 180 } |
| 182 | 181 |
| 183 // Returns a vector of all the removable mass storage devices that are | 182 // Returns a vector of all the removable mass storage devices that are |
| 184 // connected. | 183 // connected. |
| 185 std::vector<base::FilePath> GetAttachedDevices() { | 184 std::vector<base::FilePath> GetAttachedDevices() { |
| 186 std::vector<base::FilePath> result; | 185 std::vector<base::FilePath> result; |
| 187 base::string16 volume_name; | 186 base::string16 volume_name; |
| 188 HANDLE find_handle = FindFirstVolume(WriteInto(&volume_name, kMaxPathBufLen), | 187 HANDLE find_handle = FindFirstVolume(WriteInto(&volume_name, kMaxPathBufLen), |
| 189 kMaxPathBufLen); | 188 kMaxPathBufLen); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 callback.Run(StorageMonitor::EJECT_FAILURE); | 522 callback.Run(StorageMonitor::EJECT_FAILURE); |
| 524 return; | 523 return; |
| 525 } | 524 } |
| 526 | 525 |
| 527 task_runner_->PostTask( | 526 task_runner_->PostTask( |
| 528 FROM_HERE, | 527 FROM_HERE, |
| 529 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); | 528 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
| 530 } | 529 } |
| 531 | 530 |
| 532 } // namespace storage_monitor | 531 } // namespace storage_monitor |
| OLD | NEW |