Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1238)

Unified Diff: chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc

Issue 329643002: Media Galleries: Allow readding blacklisted iApps libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a short unittest for the preferences lookup Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
index 8adc508175af482d39227b21ba077d7b6caee513..909b4934491db2cd4168fc5fc1c6074962259c03 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl.cc
@@ -54,4 +54,37 @@ void FindITunesLibrary(const IAppsFinderCallback& callback) {
}
#endif
+bool PathIndicatesIPhotoLibrary(const std::string& device_id,
+ const base::FilePath& path) {
+ storage_monitor::StorageInfo::Type device_type;
+ std::string unique_id;
+ storage_monitor::StorageInfo::CrackDeviceId(
+ device_id, &device_type, &unique_id);
+ DCHECK_EQ(device_type, storage_monitor::StorageInfo::Type::IPHOTO);
+
+ // |unique_id| is the path to the library XML file at the library root.
+ base::FilePath library_root =
+ base::FilePath::FromUTF8Unsafe(unique_id).DirName();
+ return (path == library_root) ||
+ (path == library_root.AppendASCII("Data")) ||
+ (path == library_root.AppendASCII("Originals")) ||
+ (path == library_root.AppendASCII("Masters"));
+}
+
+bool PathIndicatesITunesLibrary(const std::string& device_id,
+ const base::FilePath& path) {
+ storage_monitor::StorageInfo::Type device_type;
+ std::string unique_id;
+ storage_monitor::StorageInfo::CrackDeviceId(
+ device_id, &device_type, &unique_id);
+ DCHECK_EQ(device_type, storage_monitor::StorageInfo::Type::ITUNES);
+
+ // |unique_id| is the path to the library XML file at the library root.
+ base::FilePath library_root =
+ base::FilePath::FromUTF8Unsafe(unique_id).DirName();
+ return (path == library_root) ||
+ (path == library_root.AppendASCII("iTunes Media")) ||
+ (path == library_root.AppendASCII("iTunes Media").AppendASCII("Music"));
+}
+
} // namespace iapps

Powered by Google App Engine
This is Rietveld 408576698