Chromium Code Reviews| Index: chrome/browser/media_gallery/media_device_notifications_chromeos.cc |
| diff --git a/chrome/browser/media_gallery/media_device_notifications_chromeos.cc b/chrome/browser/media_gallery/media_device_notifications_chromeos.cc |
| index ae45d1563fb26fa80438c33ca086cd80a1332b80..14fd3156e83a4c3436e5a6b2aa5989bb4afd0ade 100644 |
| --- a/chrome/browser/media_gallery/media_device_notifications_chromeos.cc |
| +++ b/chrome/browser/media_gallery/media_device_notifications_chromeos.cc |
| @@ -73,6 +73,8 @@ void MediaDeviceNotifications::MountCompleted( |
| MountMap::iterator it = mount_map_.find(mount_info.mount_path); |
| if (it == mount_map_.end()) |
| return; |
| + |
| + LOG(ERROR) << "UNMOUNTING DEVICE ID: " << it->second << "\n"; |
| base::SystemMonitor::Get()->ProcessMediaDeviceDetached(it->second); |
| mount_map_.erase(it); |
| break; |
| @@ -101,7 +103,23 @@ void MediaDeviceNotifications::AddMountedPathOnUIThread( |
| NOTREACHED(); |
| return; |
| } |
| - const std::string device_id_str = base::IntToString(current_device_id_++); |
| + |
| + // Get the media device uuid if exists. |
| + const disks::DiskMountManager::DiskMap& disks = |
| + disks::DiskMountManager::GetInstance()->disks(); |
| + disks::DiskMountManager::DiskMap::const_iterator iter = |
| + disks.find(mount_info.source_path); |
| + std::string device_id_str; |
| + if (iter != disks.end()) { |
|
Lei Zhang
2012/07/26 02:17:32
nit: would you mind using |it| instead of |iter| t
Lei Zhang
2012/07/26 02:17:32
If I understand the disk manager code correctly, I
kmadhusu
2012/07/26 17:01:23
Done.
kmadhusu
2012/07/26 17:01:23
I was not able to use CHECK_NE. Why do you think i
|
| + const disks::DiskMountManager::Disk& disk = *iter->second; |
| + device_id_str = disk.fs_uuid(); |
| + } |
| + // TODO(kmadhusu, thestig): Set the unique id for mtp devices. |
| + if (device_id_str.empty()) |
| + device_id_str = base::IntToString(current_device_id_++); |
|
Lei Zhang
2012/07/26 02:17:32
You should get rid of |current_device_id_|. Trying
kmadhusu
2012/07/26 17:01:23
Done.
|
| + |
| + LOG(ERROR) << "MOUNTING DEVICE ID: " << device_id_str << "\n"; |
| + |
| mount_map_.insert(std::make_pair(mount_info.mount_path, device_id_str)); |
| base::SystemMonitor::Get()->ProcessMediaDeviceAttached( |
| device_id_str, |