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..eb21ebbaded4ff0fe43690e5481724920bd67999 100644 |
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc |
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc |
@@ -668,6 +668,34 @@ 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 = |
vandebo (ex-Chrome)
2014/06/11 16:40:56
This is where cheating on the iTunes/iPhoto device
tommycli
2014/06/11 18:17:56
Yeah... it's true...
|
+ 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)) |
vandebo (ex-Chrome)
2014/06/11 16:40:56
Instead of cracking it here, use StorageInfo::IsIT
tommycli
2014/06/11 18:17:56
Done.
|
+ continue; |
+ |
+ bool match = false; |
+ switch (device_type) { |
+ case StorageInfo::Type::IPHOTO: |
+ match = iapps::PathIndicatesIPhotoLibrary(unique_id, path); |
+ break; |
+ case StorageInfo::Type::ITUNES: |
+ match = iapps::PathIndicatesITunesLibrary(unique_id, path); |
+ break; |
+ default: |
+ break; |
+ } |
+ |
+ if (match) { |
+ *gallery_info = it->second; |
+ return true; |
+ } |
+ } |
+ |
StorageInfo info; |
base::FilePath relative_path; |
if (!MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { |