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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h" 5 #include "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 #endif // !defined(OS_MACOSX) 48 #endif // !defined(OS_MACOSX)
49 49
50 // iTunes is only support on OSX and Windows. 50 // iTunes is only support on OSX and Windows.
51 #if !defined(OS_MACOSX) && !defined(OS_WIN) 51 #if !defined(OS_MACOSX) && !defined(OS_WIN)
52 void FindITunesLibrary(const IAppsFinderCallback& callback) { 52 void FindITunesLibrary(const IAppsFinderCallback& callback) {
53 callback.Run(std::string()); 53 callback.Run(std::string());
54 } 54 }
55 #endif 55 #endif
56 56
57 bool PathIndicatesIPhotoLibrary(const std::string& device_id,
58 const base::FilePath& path) {
59 storage_monitor::StorageInfo::Type device_type;
60 std::string unique_id;
61 storage_monitor::StorageInfo::CrackDeviceId(
62 device_id, &device_type, &unique_id);
63 DCHECK_EQ(device_type, storage_monitor::StorageInfo::Type::IPHOTO);
64
65 // |unique_id| is the path to the library XML file at the library root.
66 base::FilePath library_root =
67 base::FilePath::FromUTF8Unsafe(unique_id).DirName();
68 return (path == library_root) ||
69 (path == library_root.AppendASCII("Data")) ||
70 (path == library_root.AppendASCII("Originals")) ||
71 (path == library_root.AppendASCII("Masters"));
72 }
73
74 bool PathIndicatesITunesLibrary(const std::string& device_id,
75 const base::FilePath& path) {
76 storage_monitor::StorageInfo::Type device_type;
77 std::string unique_id;
78 storage_monitor::StorageInfo::CrackDeviceId(
79 device_id, &device_type, &unique_id);
80 DCHECK_EQ(device_type, storage_monitor::StorageInfo::Type::ITUNES);
81
82 // |unique_id| is the path to the library XML file at the library root.
83 base::FilePath library_root =
84 base::FilePath::FromUTF8Unsafe(unique_id).DirName();
85 return (path == library_root) ||
86 (path == library_root.AppendASCII("iTunes Media")) ||
87 (path == library_root.AppendASCII("iTunes Media").AppendASCII("Music"));
88 }
89
57 } // namespace iapps 90 } // namespace iapps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698