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/storage_monitor_mac.h" | 5 #include "chrome/browser/storage_monitor/storage_monitor_mac.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if (FindDiskWithMountPoint(current, &info)) { | 280 if (FindDiskWithMountPoint(current, &info)) { |
281 *device_info = info; | 281 *device_info = info; |
282 return true; | 282 return true; |
283 } | 283 } |
284 current = current.DirName(); | 284 current = current.DirName(); |
285 } | 285 } |
286 | 286 |
287 return false; | 287 return false; |
288 } | 288 } |
289 | 289 |
290 uint64 StorageMonitorMac::GetStorageSize(const std::string& location) const { | |
291 StorageInfo info; | |
292 if (!FindDiskWithMountPoint(base::FilePath(location), &info)) | |
293 return 0; | |
294 return info.total_size_in_bytes; | |
295 } | |
296 | |
297 void StorageMonitorMac::EjectDevice( | 290 void StorageMonitorMac::EjectDevice( |
298 const std::string& device_id, | 291 const std::string& device_id, |
299 base::Callback<void(EjectStatus)> callback) { | 292 base::Callback<void(EjectStatus)> callback) { |
300 std::string bsd_name; | 293 std::string bsd_name; |
301 for (std::map<std::string, StorageInfo>::iterator | 294 for (std::map<std::string, StorageInfo>::iterator |
302 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { | 295 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { |
303 if (it->second.device_id == device_id) { | 296 if (it->second.device_id == device_id) { |
304 bsd_name = it->first; | 297 bsd_name = it->first; |
305 disk_info_map_.erase(it); | 298 disk_info_map_.erase(it); |
306 break; | 299 break; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { | 367 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { |
375 if (it->second.location == mount_point.value()) { | 368 if (it->second.location == mount_point.value()) { |
376 *info = it->second; | 369 *info = it->second; |
377 return true; | 370 return true; |
378 } | 371 } |
379 } | 372 } |
380 return false; | 373 return false; |
381 } | 374 } |
382 | 375 |
383 } // namespace chrome | 376 } // namespace chrome |
OLD | NEW |