Chromium Code Reviews| Index: chrome/browser/media_gallery/media_file_system_registry.cc |
| diff --git a/chrome/browser/media_gallery/media_file_system_registry.cc b/chrome/browser/media_gallery/media_file_system_registry.cc |
| index 3cb34d76273748cede69d5423d9b0143edcf7ec6..5bc2480a00e0aeb72871d105c5922b2cc254b1d8 100644 |
| --- a/chrome/browser/media_gallery/media_file_system_registry.cc |
| +++ b/chrome/browser/media_gallery/media_file_system_registry.cc |
| @@ -482,9 +482,6 @@ void MediaFileSystemRegistry::GetMediaFileSystemsForExtension( |
| Profile::FromBrowserContext(rvh->GetProcess()->GetBrowserContext()); |
| MediaGalleriesPreferences* preferences = |
| MediaGalleriesPreferencesFactory::GetForProfile(profile); |
| - |
| - if (!ContainsKey(extension_hosts_map_, profile)) |
| - AddAttachedMediaDeviceGalleries(preferences); |
|
vandebo (ex-Chrome)
2012/10/27 19:57:57
Maybe we should still call the new function here?
kmadhusu
2012/10/28 01:13:43
I don't think this call is required here. This fu
|
| MediaGalleryPrefIdSet galleries = |
| preferences->GalleriesForExtension(*extension); |
| @@ -578,6 +575,32 @@ void MediaFileSystemRegistry::OnRemovableStorageDetached( |
| } |
| } |
| +void MediaFileSystemRegistry::AddAttachedMediaDeviceGalleries( |
| + const content::RenderViewHost* rvh) { |
| + Profile* profile = |
| + Profile::FromBrowserContext(rvh->GetProcess()->GetBrowserContext()); |
| + if (ContainsKey(extension_hosts_map_, profile)) |
| + return; // Devices already enumerated. |
| + |
| + // SystemMonitor may be NULL in unit tests. |
| + SystemMonitor* system_monitor = SystemMonitor::Get(); |
| + if (!system_monitor) |
| + return; |
| + |
| + std::vector<SystemMonitor::RemovableStorageInfo> existing_devices = |
| + system_monitor->GetAttachedRemovableStorage(); |
| + MediaGalleriesPreferences* preferences = |
| + MediaGalleriesPreferencesFactory::GetForProfile(profile); |
| + DCHECK(preferences); |
| + for (size_t i = 0; i < existing_devices.size(); i++) { |
| + if (!MediaStorageUtil::IsMediaDevice(existing_devices[i].device_id)) |
| + continue; |
| + preferences->AddGallery(existing_devices[i].device_id, |
| + existing_devices[i].name, FilePath(), |
| + false /*not user added*/); |
| + } |
| +} |
| + |
| /****************** |
| * Private methods |
| ******************/ |
| @@ -678,24 +701,6 @@ void MediaFileSystemRegistry::RemoveScopedMtpDeviceMapEntry( |
| } |
| #endif |
| -void MediaFileSystemRegistry::AddAttachedMediaDeviceGalleries( |
| - MediaGalleriesPreferences* preferences) { |
| - // SystemMonitor may be NULL in unit tests. |
| - SystemMonitor* system_monitor = SystemMonitor::Get(); |
| - if (!system_monitor) |
| - return; |
| - |
| - std::vector<SystemMonitor::RemovableStorageInfo> existing_devices = |
| - system_monitor->GetAttachedRemovableStorage(); |
| - for (size_t i = 0; i < existing_devices.size(); i++) { |
| - if (!MediaStorageUtil::IsMediaDevice(existing_devices[i].device_id)) |
| - continue; |
| - preferences->AddGallery(existing_devices[i].device_id, |
| - existing_devices[i].name, FilePath(), |
| - false /*not user added*/); |
| - } |
| -} |
| - |
| void MediaFileSystemRegistry::OnExtensionGalleriesHostEmpty( |
| Profile* profile, const std::string& extension_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |