Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3157)

Unified Diff: chrome/browser/system_monitor/portable_device_watcher_win.cc

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comment and disabled MediaFileSystemRegistryTest.GalleryNameMTP Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5edbe2783f57e32d942276fee9bfb66730c16624 100644
--- a/chrome/browser/system_monitor/portable_device_watcher_win.cc
+++ b/chrome/browser/system_monitor/portable_device_watcher_win.cc
@@ -516,6 +516,34 @@ 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;
Lei Zhang 2013/01/14 23:25:30 If you delay assigning to |device_location| until
kmadhusu 2013/01/15 19:08:17 Done.
+ MTPDeviceMap::const_iterator device_iter = device_map_.find(*device_location);
+ if (device_iter == device_map_.end())
+ return false;
+ 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;
Lei Zhang 2013/01/14 20:49:02 You can just return true here and return false at
kmadhusu 2013/01/15 19:08:17 Done.
+ }
+ }
+ return !storage_object_id->empty();
+}
+
void PortableDeviceWatcherWin::EnumerateAttachedDevices() {
DCHECK(media_task_runner_.get());
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));

Powered by Google App Engine
This is Rietveld 408576698