Chromium Code Reviews| Index: chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc |
| diff --git a/chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc b/chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc |
| index f84ace5779efafa7b5b900ade4a026b3574dfab5..0c9ce3e50b4e537f96d0d053281c36fa221f1348 100644 |
| --- a/chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc |
| +++ b/chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.cc |
| @@ -165,6 +165,19 @@ bool MediaTransferProtocolDeviceObserverLinux::GetStorageInfoForPath( |
| return true; |
| } |
| +void MediaTransferProtocolDeviceObserverLinux::EjectDevice( |
| + const std::string& device_id, |
| + base::Callback<void(StorageMonitor::EjectStatus)> callback) { |
| + std::string location; |
| + if (!GetLocationForDeviceId(device_id, &location)) { |
| + callback.Run(StorageMonitor::EJECT_NO_SUCH_DEVICE); |
| + return; |
| + } |
| + |
| + StorageChanged(false, location); |
|
Lei Zhang
2013/08/21 21:37:53
We may be able to do more here, and communicate wi
Greg Billock
2013/08/23 20:17:14
Done.
|
| + callback.Run(StorageMonitor::EJECT_OK); |
| +} |
| + |
| // device::MediaTransferProtocolManager::Observer override. |
| void MediaTransferProtocolDeviceObserverLinux::StorageChanged( |
| bool is_attached, |
| @@ -211,4 +224,17 @@ void MediaTransferProtocolDeviceObserverLinux::EnumerateStorages() { |
| } |
| } |
| +bool MediaTransferProtocolDeviceObserverLinux::GetLocationForDeviceId( |
|
Lei Zhang
2013/08/21 21:37:53
Can't you just return a std::string, with an empty
Lei Zhang
2013/08/21 21:37:53
nit: const method
Greg Billock
2013/08/23 20:17:14
I actually had that. :-) Switched to this as I thi
Greg Billock
2013/08/23 20:17:14
Done.
|
| + const std::string& device_id, std::string* location) { |
| + for (StorageLocationToInfoMap::iterator it = storage_map_.begin(); |
| + it != storage_map_.end(); ++it) { |
| + if (it->second.device_id() == device_id) { |
| + *location = it->first; |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| } // namespace chrome |