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..afb9a78a6c99104b2a7584c964cb682503023738 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,21 @@ 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; |
+ } |
+ |
+ // TODO(thestig): Change this to tell the mtp manager to eject the device. |
+ |
+ StorageChanged(false, location); |
+ callback.Run(StorageMonitor::EJECT_OK); |
+} |
+ |
// device::MediaTransferProtocolManager::Observer override. |
void MediaTransferProtocolDeviceObserverLinux::StorageChanged( |
bool is_attached, |
@@ -211,4 +226,17 @@ void MediaTransferProtocolDeviceObserverLinux::EnumerateStorages() { |
} |
} |
+bool MediaTransferProtocolDeviceObserverLinux::GetLocationForDeviceId( |
+ const std::string& device_id, std::string* location) const { |
+ for (StorageLocationToInfoMap::const_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 |