OLD | NEW |
---|---|
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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... | |
31 // This class lives on the MediaTaskRunner thread. It has some static | 31 // This class lives on the MediaTaskRunner thread. It has some static |
32 // methods which are called on the UI thread. | 32 // methods which are called on the UI thread. |
33 // | 33 // |
34 // MediaTaskRunner is not guaranteed to be one thread, but it is guaranteed | 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. | 35 // to be a series of sequential calls. See SequencedTaskRunner for details. |
36 class ImportedMediaGalleryRegistry { | 36 class ImportedMediaGalleryRegistry { |
37 public: | 37 public: |
38 static ImportedMediaGalleryRegistry* GetInstance(); | 38 static ImportedMediaGalleryRegistry* GetInstance(); |
39 | 39 |
40 // Should be called on the UI thread only. | 40 // Should be called on the UI thread only. |
41 std::string RegisterPicasaFilesystemOnUIThread( | 41 bool RegisterPicasaFilesystemOnUIThread(const std::string& fs_name, |
42 const base::FilePath& database_path); | 42 const base::FilePath& database_path); |
43 | 43 |
44 std::string RegisterITunesFilesystemOnUIThread( | 44 bool RegisterITunesFilesystemOnUIThread( |
45 const std::string& fs_name, | |
45 const base::FilePath& xml_library_path); | 46 const base::FilePath& xml_library_path); |
46 | 47 |
47 std::string RegisterIPhotoFilesystemOnUIThread( | 48 bool RegisterIPhotoFilesystemOnUIThread( |
49 const std::string& fs_name, | |
48 const base::FilePath& xml_library_path); | 50 const base::FilePath& xml_library_path); |
49 | 51 |
50 bool RevokeImportedFilesystemOnUIThread(const std::string& fsid); | 52 bool RevokeImportedFilesystemOnUIThread(const std::string& fs_name); |
51 | 53 |
52 // Should be called on the MediaTaskRunner thread only. | 54 // Should be called on the MediaTaskRunner thread only. |
53 #if defined(OS_WIN) || defined(OS_MACOSX) | 55 #if defined(OS_WIN) || defined(OS_MACOSX) |
54 static picasa::PicasaDataProvider* PicasaDataProvider(); | 56 static picasa::PicasaDataProvider* PicasaDataProvider(); |
55 static itunes::ITunesDataProvider* ITunesDataProvider(); | 57 static itunes::ITunesDataProvider* ITunesDataProvider(); |
56 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 58 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
57 | 59 |
58 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
59 static iphoto::IPhotoDataProvider* IPhotoDataProvider(); | 61 static iphoto::IPhotoDataProvider* IPhotoDataProvider(); |
60 #endif // defined(OS_MACOSX) | 62 #endif // defined(OS_MACOSX) |
61 | 63 |
62 private: | 64 private: |
63 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; | 65 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; |
64 friend class iphoto::IPhotoDataProviderTest; | 66 friend class iphoto::IPhotoDataProviderTest; |
65 friend class itunes::ITunesDataProviderTest; | 67 friend class itunes::ITunesDataProviderTest; |
66 friend class picasa::PicasaDataProviderTest; | 68 friend class picasa::PicasaDataProviderTest; |
67 | 69 |
68 ImportedMediaGalleryRegistry(); | 70 ImportedMediaGalleryRegistry(); |
69 virtual ~ImportedMediaGalleryRegistry(); | 71 virtual ~ImportedMediaGalleryRegistry(); |
70 | 72 |
73 base::FilePath ImportedRoot(); | |
74 | |
71 #if defined(OS_WIN) || defined(OS_MACOSX) | 75 #if defined(OS_WIN) || defined(OS_MACOSX) |
72 void RegisterPicasaFileSystem(const base::FilePath& database_path); | 76 void RegisterPicasaFileSystem(const base::FilePath& database_path); |
73 void RevokePicasaFileSystem(); | 77 void RevokePicasaFileSystem(); |
74 | 78 |
75 void RegisterITunesFileSystem(const base::FilePath& xml_library_path); | 79 void RegisterITunesFileSystem(const base::FilePath& xml_library_path); |
76 void RevokeITunesFileSystem(); | 80 void RevokeITunesFileSystem(); |
77 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 81 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
78 | 82 |
79 #if defined(OS_MACOSX) | 83 #if defined(OS_MACOSX) |
80 void RegisterIPhotoFileSystem(const base::FilePath& xml_library_path); | 84 void RegisterIPhotoFileSystem(const base::FilePath& xml_library_path); |
81 void RevokeIPhotoFileSystem(); | 85 void RevokeIPhotoFileSystem(); |
82 #endif // defined(OS_MACOSX) | 86 #endif // defined(OS_MACOSX) |
83 | 87 |
88 base::FilePath imported_root_; | |
Lei Zhang
2014/03/20 00:46:26
Who deletes this folder?
vandebo (ex-Chrome)
2014/03/20 18:08:53
Added a delete to the destructor - we don't seem t
| |
89 | |
84 #if defined(OS_WIN) || defined(OS_MACOSX) | 90 #if defined(OS_WIN) || defined(OS_MACOSX) |
85 // The data providers are only set or accessed on the task runner thread. | 91 // The data providers are only set or accessed on the task runner thread. |
86 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; | 92 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; |
87 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_; | 93 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_; |
88 | 94 |
89 // The remaining members are only accessed on the IO thread. | 95 // The remaining members are only accessed on the IO thread. |
90 std::set<std::string> picasa_fsids_; | 96 std::set<std::string> picasa_fs_names_; |
91 std::set<std::string> itunes_fsids_; | 97 std::set<std::string> itunes_fs_names_; |
92 | 98 |
93 #ifndef NDEBUG | 99 #ifndef NDEBUG |
94 base::FilePath picasa_database_path_; | 100 base::FilePath picasa_database_path_; |
95 base::FilePath itunes_xml_library_path_; | 101 base::FilePath itunes_xml_library_path_; |
96 #endif | 102 #endif |
97 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 103 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
98 | 104 |
99 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
100 scoped_ptr<iphoto::IPhotoDataProvider> iphoto_data_provider_; | 106 scoped_ptr<iphoto::IPhotoDataProvider> iphoto_data_provider_; |
101 | 107 |
102 std::set<std::string> iphoto_fsids_; | 108 std::set<std::string> iphoto_fs_names_; |
103 | 109 |
104 #ifndef NDEBUG | 110 #ifndef NDEBUG |
105 base::FilePath iphoto_xml_library_path_; | 111 base::FilePath iphoto_xml_library_path_; |
106 #endif | 112 #endif |
107 #endif // defined(OS_MACOSX) | 113 #endif // defined(OS_MACOSX) |
108 | 114 |
109 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); | 115 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); |
110 }; | 116 }; |
111 | 117 |
112 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ | 118 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ |
OLD | NEW |