Disabling NativeViewAcccessibilityWinTest.RetrieveAllAlerts.
[chromium-blink-merge.git] / chrome / browser / media_galleries / imported_media_gallery_registry.h
blob8c343c135a68d5f3541a5b248d81a6394b884b05
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_
8 #include <set>
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/files/file_path.h"
13 #include "base/lazy_instance.h"
14 #include "base/memory/scoped_ptr.h"
16 namespace iphoto {
17 class IPhotoDataProvider;
18 class IPhotoDataProviderTest;
21 namespace itunes {
22 class ITunesDataProvider;
23 class ITunesDataProviderTest;
26 namespace picasa {
27 class PicasaDataProvider;
28 class PicasaDataProviderTest;
31 // This class lives on the MediaTaskRunner thread. It has some static
32 // methods which are called on the UI thread.
34 // MediaTaskRunner is not guaranteed to be one thread, but it is guaranteed
35 // to be a series of sequential calls. See SequencedTaskRunner for details.
36 class ImportedMediaGalleryRegistry {
37 public:
38 static ImportedMediaGalleryRegistry* GetInstance();
40 void Initialize();
42 // Should be called on the UI thread only.
43 bool RegisterPicasaFilesystemOnUIThread(const std::string& fs_name,
44 const base::FilePath& database_path);
46 bool RegisterITunesFilesystemOnUIThread(
47 const std::string& fs_name,
48 const base::FilePath& xml_library_path);
50 bool RegisterIPhotoFilesystemOnUIThread(
51 const std::string& fs_name,
52 const base::FilePath& xml_library_path);
54 bool RevokeImportedFilesystemOnUIThread(const std::string& fs_name);
56 // Path where all virtual file systems are "mounted."
57 base::FilePath ImportedRoot();
59 // Should be called on the MediaTaskRunner thread only.
60 #if defined(OS_WIN) || defined(OS_MACOSX)
61 static picasa::PicasaDataProvider* PicasaDataProvider();
62 static itunes::ITunesDataProvider* ITunesDataProvider();
63 #endif // defined(OS_WIN) || defined(OS_MACOSX)
65 #if defined(OS_MACOSX)
66 static iphoto::IPhotoDataProvider* IPhotoDataProvider();
67 #endif // defined(OS_MACOSX)
69 private:
70 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>;
71 friend class iphoto::IPhotoDataProviderTest;
72 friend class itunes::ITunesDataProviderTest;
73 friend class picasa::PicasaDataProviderTest;
75 ImportedMediaGalleryRegistry();
76 virtual ~ImportedMediaGalleryRegistry();
78 #if defined(OS_WIN) || defined(OS_MACOSX)
79 void RegisterPicasaFileSystem(const base::FilePath& database_path);
80 void RevokePicasaFileSystem();
82 void RegisterITunesFileSystem(const base::FilePath& xml_library_path);
83 void RevokeITunesFileSystem();
84 #endif // defined(OS_WIN) || defined(OS_MACOSX)
86 #if defined(OS_MACOSX)
87 void RegisterIPhotoFileSystem(const base::FilePath& xml_library_path);
88 void RevokeIPhotoFileSystem();
89 #endif // defined(OS_MACOSX)
91 base::FilePath imported_root_;
93 #if defined(OS_WIN) || defined(OS_MACOSX)
94 // The data providers are only set or accessed on the task runner thread.
95 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_;
96 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_;
98 // The remaining members are only accessed on the IO thread.
99 std::set<std::string> picasa_fs_names_;
100 std::set<std::string> itunes_fs_names_;
102 #ifndef NDEBUG
103 base::FilePath picasa_database_path_;
104 base::FilePath itunes_xml_library_path_;
105 #endif
106 #endif // defined(OS_WIN) || defined(OS_MACOSX)
108 #if defined(OS_MACOSX)
109 scoped_ptr<iphoto::IPhotoDataProvider> iphoto_data_provider_;
111 std::set<std::string> iphoto_fs_names_;
113 #ifndef NDEBUG
114 base::FilePath iphoto_xml_library_path_;
115 #endif
116 #endif // defined(OS_MACOSX)
118 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry);
121 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_