Chromium Code Reviews| Index: chrome/browser/system_monitor/portable_device_watcher_win.cc |
| diff --git a/chrome/browser/system_monitor/portable_device_watcher_win.cc b/chrome/browser/system_monitor/portable_device_watcher_win.cc |
| index bd326adf79082383620880e8088a759349fe8ef4..d7eca1703881234434c78f3a1e24294ab2655618 100644 |
| --- a/chrome/browser/system_monitor/portable_device_watcher_win.cc |
| +++ b/chrome/browser/system_monitor/portable_device_watcher_win.cc |
| @@ -516,6 +516,33 @@ void PortableDeviceWatcherWin::OnWindowMessage(UINT event_type, LPARAM data) { |
| HandleDeviceDetachEvent(device_id); |
| } |
| +bool PortableDeviceWatcherWin::GetMTPStorageInfoFromDeviceId( |
| + const std::string& storage_device_id, |
| + string16* device_location, |
| + string16* storage_object_id) { |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| + DCHECK(device_location); |
| + DCHECK(storage_object_id); |
| + MTPStorageMap::const_iterator storage_map_iter = |
| + storage_map_.find(storage_device_id); |
| + if (storage_map_iter == storage_map_.end()) |
| + return false; |
| + |
| + *device_location = storage_map_iter->second.location; |
| + MTPDeviceMap::const_iterator device_iter = device_map_.find(*device_location); |
| + DCHECK(device_iter != device_map_.end()); |
|
Ryan Sleevi
2013/01/09 20:22:25
This DCHECK leaves me a lil squicky, since AIUI, t
kmadhusu
2013/01/10 04:59:19
When the device is removed, line 528 will be true
|
| + const StorageObjects& storage_objects = device_iter->second; |
| + for (StorageObjects::const_iterator storage_object_iter = |
| + storage_objects.begin(); storage_object_iter != storage_objects.end(); |
| + ++storage_object_iter) { |
| + if (storage_device_id == storage_object_iter->object_persistent_id) { |
| + *storage_object_id = storage_object_iter->object_temporary_id; |
| + break; |
| + } |
| + } |
| + return !storage_object_id->empty(); |
| +} |
| + |
| void PortableDeviceWatcherWin::EnumerateAttachedDevices() { |
| DCHECK(media_task_runner_.get()); |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |