Index: chrome/browser/media_galleries/media_galleries_preferences.cc |
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc |
index a78065611f28069f9554d482510c63f5a2e1c0e7..f29c4d693d03571390cef0665562d85a75f917b7 100644 |
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc |
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc |
@@ -668,6 +668,25 @@ bool MediaGalleriesPreferences::LookUpGalleryByPath( |
const base::FilePath& path, |
MediaGalleryPrefInfo* gallery_info) const { |
DCHECK(IsInitialized()); |
+ |
+ // First check if the path matches an imported gallery. |
+ for (MediaGalleriesPrefInfoMap::const_iterator it = |
+ known_galleries_.begin(); it != known_galleries_.end(); ++it) { |
+ const std::string& device_id = it->second.device_id; |
+ StorageInfo::Type device_type; |
+ std::string unique_id; |
+ if (!StorageInfo::CrackDeviceId(device_id, &device_type, &unique_id)) |
+ continue; |
+ |
+ if (device_type == StorageInfo::Type::IPHOTO || |
+ device_type == StorageInfo::Type::ITUNES) { |
+ if (iapps::PathWithinIAppsLibrary(unique_id, path)) { |
+ *gallery_info = it->second; |
+ return true; |
+ } |
+ } |
+ } |
+ |
StorageInfo info; |
base::FilePath relative_path; |
if (!MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { |