OLD | NEW |
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 #include "chrome/browser/storage_monitor/volume_mount_watcher_win.h" | 5 #include "chrome/browser/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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 base::string16 volume_label; | 166 base::string16 volume_label; |
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 = StorageInfo::MakeDeviceId(type, UTF16ToUTF8(guid)); | 172 std::string device_id = StorageInfo::MakeDeviceId(type, UTF16ToUTF8(guid)); |
173 | 173 |
174 // TODO(gbillock): if volume_label.empty(), get the vendor/model information | 174 // TODO(gbillock): if volume_label.empty(), get the vendor/model information |
175 // for the volume. | 175 // for the volume. |
176 *info = StorageInfo(device_id, base::string16(), mount_point, | 176 *info = StorageInfo(device_id, mount_point, volume_label, base::string16(), |
177 volume_label, base::string16(), base::string16(), | 177 base::string16(), total_size_in_bytes); |
178 total_size_in_bytes); | |
179 return true; | 178 return true; |
180 } | 179 } |
181 | 180 |
182 // Returns a vector of all the removable mass storage devices that are | 181 // Returns a vector of all the removable mass storage devices that are |
183 // connected. | 182 // connected. |
184 std::vector<base::FilePath> GetAttachedDevices() { | 183 std::vector<base::FilePath> GetAttachedDevices() { |
185 std::vector<base::FilePath> result; | 184 std::vector<base::FilePath> result; |
186 base::string16 volume_name; | 185 base::string16 volume_name; |
187 HANDLE find_handle = FindFirstVolume(WriteInto(&volume_name, kMaxPathBufLen), | 186 HANDLE find_handle = FindFirstVolume(WriteInto(&volume_name, kMaxPathBufLen), |
188 kMaxPathBufLen); | 187 kMaxPathBufLen); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 callback.Run(StorageMonitor::EJECT_FAILURE); | 521 callback.Run(StorageMonitor::EJECT_FAILURE); |
523 return; | 522 return; |
524 } | 523 } |
525 | 524 |
526 task_runner_->PostTask( | 525 task_runner_->PostTask( |
527 FROM_HERE, | 526 FROM_HERE, |
528 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); | 527 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
529 } | 528 } |
530 | 529 |
531 } // namespace chrome | 530 } // namespace chrome |
OLD | NEW |