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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 current = current.DirName(); | 266 current = current.DirName(); |
267 } | 267 } |
268 | 268 |
269 return false; | 269 return false; |
270 } | 270 } |
271 | 271 |
272 void StorageMonitorMac::EjectDevice( | 272 void StorageMonitorMac::EjectDevice( |
273 const std::string& device_id, | 273 const std::string& device_id, |
274 base::Callback<void(EjectStatus)> callback) { | 274 base::Callback<void(EjectStatus)> callback) { |
| 275 StorageInfo::Type type; |
| 276 std::string uuid; |
| 277 if (!StorageInfo::CrackDeviceId(device_id, &type, &uuid)) { |
| 278 callback.Run(EJECT_FAILURE); |
| 279 return; |
| 280 } |
| 281 |
| 282 if (type == StorageInfo::MAC_IMAGE_CAPTURE && |
| 283 image_capture_device_manager_.get()) { |
| 284 image_capture_device_manager_->EjectDevice(uuid, callback); |
| 285 return; |
| 286 } |
| 287 |
275 std::string bsd_name; | 288 std::string bsd_name; |
276 for (std::map<std::string, StorageInfo>::iterator | 289 for (std::map<std::string, StorageInfo>::iterator |
277 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { | 290 it = disk_info_map_.begin(); it != disk_info_map_.end(); ++it) { |
278 if (it->second.device_id() == device_id) { | 291 if (it->second.device_id() == device_id) { |
279 bsd_name = it->first; | 292 bsd_name = it->first; |
280 disk_info_map_.erase(it); | 293 disk_info_map_.erase(it); |
281 break; | 294 break; |
282 } | 295 } |
283 } | 296 } |
284 | 297 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 380 } |
368 } | 381 } |
369 return false; | 382 return false; |
370 } | 383 } |
371 | 384 |
372 StorageMonitor* StorageMonitor::Create() { | 385 StorageMonitor* StorageMonitor::Create() { |
373 return new StorageMonitorMac(); | 386 return new StorageMonitorMac(); |
374 } | 387 } |
375 | 388 |
376 } // namespace chrome | 389 } // namespace chrome |
OLD | NEW |