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..2a9b11eb1c03dd93e125297026574c4a9a067929 100644 |
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc |
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc |
@@ -668,6 +668,24 @@ 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; |
vandebo (ex-Chrome)
2014/06/11 18:36:46
If PathIndicates... checks the device type instead
tommycli
2014/06/11 19:26:39
Done.
|
+ bool match = false; |
+ if (StorageInfo::IsIPhotoDevice(device_id)) { |
+ match = iapps::PathIndicatesIPhotoLibrary(device_id, path); |
+ } else if (StorageInfo::IsITunesDevice(device_id)) { |
+ match = iapps::PathIndicatesITunesLibrary(device_id, path); |
+ } |
+ |
+ if (match) { |
+ *gallery_info = it->second; |
+ return true; |
+ } |
+ } |
+ |
StorageInfo info; |
base::FilePath relative_path; |
if (!MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { |