Index: chrome/browser/storage_monitor/storage_monitor_chromeos.cc |
diff --git a/chrome/browser/storage_monitor/storage_monitor_chromeos.cc b/chrome/browser/storage_monitor/storage_monitor_chromeos.cc |
index f07a0cf7914fbf6cb260c3ae684c20fcbe4bfda6..8a2cbbc0196a1572feafbc00faa2814ea0faca75 100644 |
--- a/chrome/browser/storage_monitor/storage_monitor_chromeos.cc |
+++ b/chrome/browser/storage_monitor/storage_monitor_chromeos.cc |
@@ -212,6 +212,39 @@ uint64 StorageMonitorCros::GetStorageSize( |
info_it->second.total_size_in_bytes : 0; |
} |
+void NotifyEjectSuccess( |
+ base::Callback<void(chrome::StorageMonitor::EjectStatus)> callback) { |
+ callback.Run(chrome::StorageMonitor::EJECT_OK); |
+} |
+ |
+void StorageMonitorCros::EjectDevice( |
+ const std::string& device_id, |
+ base::Callback<void(EjectStatus)> callback) { |
+ std::string mount_path; |
+ for (MountMap::const_iterator info_it = mount_map_.begin(); |
+ info_it != mount_map_.end(); info_it++) { |
Lei Zhang
2013/03/13 22:39:27
nit: ++info_it
Greg Billock
2013/03/18 19:38:40
Done.
|
+ if (info_it->second.device_id == device_id) |
+ mount_path = info_it->first; |
+ } |
+ |
+ if (mount_path.empty()) { |
+ callback.Run(EJECT_NO_SUCH_DEVICE); |
+ return; |
+ } |
+ |
+ disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance(); |
+ if (!manager) { |
+ callback.Run(EJECT_FAILURE); |
+ return; |
+ } |
+ |
+ manager->UnmountPath(mount_path, chromeos::UNMOUNT_OPTIONS_NONE); |
tbarzic
2013/03/13 18:57:04
unmount path may actually fail, but the success/fa
Greg Billock
2013/03/18 19:38:40
Done.
|
+ |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, |
+ base::Bind(&NotifyEjectSuccess, callback)); |
Lei Zhang
2013/03/13 22:39:27
You probably don't need NotifyEjectSuccess().
Bro
Greg Billock
2013/03/18 19:38:40
Replaced with trampoline to convert parameter from
|
+} |
+ |
void StorageMonitorCros::CheckMountedPathOnFileThread( |
const disks::DiskMountManager::MountPointInfo& mount_info) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |