Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 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 void Initialize(); | |
|
Lei Zhang
2014/03/26 23:32:46
nit: comment would be good.
| |
| 41 | |
| 40 // Should be called on the UI thread only. | 42 // Should be called on the UI thread only. |
| 41 std::string RegisterPicasaFilesystemOnUIThread( | 43 bool RegisterPicasaFilesystemOnUIThread(const std::string& fs_name, |
| 42 const base::FilePath& database_path); | 44 const base::FilePath& database_path); |
| 43 | 45 |
| 44 std::string RegisterITunesFilesystemOnUIThread( | 46 bool RegisterITunesFilesystemOnUIThread( |
| 47 const std::string& fs_name, | |
| 45 const base::FilePath& xml_library_path); | 48 const base::FilePath& xml_library_path); |
| 46 | 49 |
| 47 std::string RegisterIPhotoFilesystemOnUIThread( | 50 bool RegisterIPhotoFilesystemOnUIThread( |
| 51 const std::string& fs_name, | |
| 48 const base::FilePath& xml_library_path); | 52 const base::FilePath& xml_library_path); |
| 49 | 53 |
| 50 bool RevokeImportedFilesystemOnUIThread(const std::string& fsid); | 54 bool RevokeImportedFilesystemOnUIThread(const std::string& fs_name); |
| 55 | |
| 56 // Path where all virtual file systems are "mounted." | |
| 57 base::FilePath ImportedRoot(); | |
| 51 | 58 |
| 52 // Should be called on the MediaTaskRunner thread only. | 59 // Should be called on the MediaTaskRunner thread only. |
| 53 #if defined(OS_WIN) || defined(OS_MACOSX) | 60 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 54 static picasa::PicasaDataProvider* PicasaDataProvider(); | 61 static picasa::PicasaDataProvider* PicasaDataProvider(); |
| 55 static itunes::ITunesDataProvider* ITunesDataProvider(); | 62 static itunes::ITunesDataProvider* ITunesDataProvider(); |
| 56 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 63 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 57 | 64 |
| 58 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| 59 static iphoto::IPhotoDataProvider* IPhotoDataProvider(); | 66 static iphoto::IPhotoDataProvider* IPhotoDataProvider(); |
| 60 #endif // defined(OS_MACOSX) | 67 #endif // defined(OS_MACOSX) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 74 | 81 |
| 75 void RegisterITunesFileSystem(const base::FilePath& xml_library_path); | 82 void RegisterITunesFileSystem(const base::FilePath& xml_library_path); |
| 76 void RevokeITunesFileSystem(); | 83 void RevokeITunesFileSystem(); |
| 77 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 84 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 78 | 85 |
| 79 #if defined(OS_MACOSX) | 86 #if defined(OS_MACOSX) |
| 80 void RegisterIPhotoFileSystem(const base::FilePath& xml_library_path); | 87 void RegisterIPhotoFileSystem(const base::FilePath& xml_library_path); |
| 81 void RevokeIPhotoFileSystem(); | 88 void RevokeIPhotoFileSystem(); |
| 82 #endif // defined(OS_MACOSX) | 89 #endif // defined(OS_MACOSX) |
| 83 | 90 |
| 91 base::FilePath imported_root_; | |
| 92 | |
| 84 #if defined(OS_WIN) || defined(OS_MACOSX) | 93 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 85 // The data providers are only set or accessed on the task runner thread. | 94 // The data providers are only set or accessed on the task runner thread. |
| 86 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; | 95 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; |
| 87 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_; | 96 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_; |
| 88 | 97 |
| 89 // The remaining members are only accessed on the IO thread. | 98 // The remaining members are only accessed on the IO thread. |
| 90 std::set<std::string> picasa_fsids_; | 99 std::set<std::string> picasa_fs_names_; |
| 91 std::set<std::string> itunes_fsids_; | 100 std::set<std::string> itunes_fs_names_; |
| 92 | 101 |
| 93 #ifndef NDEBUG | 102 #ifndef NDEBUG |
| 94 base::FilePath picasa_database_path_; | 103 base::FilePath picasa_database_path_; |
| 95 base::FilePath itunes_xml_library_path_; | 104 base::FilePath itunes_xml_library_path_; |
| 96 #endif | 105 #endif |
| 97 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 106 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 98 | 107 |
| 99 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
| 100 scoped_ptr<iphoto::IPhotoDataProvider> iphoto_data_provider_; | 109 scoped_ptr<iphoto::IPhotoDataProvider> iphoto_data_provider_; |
| 101 | 110 |
| 102 std::set<std::string> iphoto_fsids_; | 111 std::set<std::string> iphoto_fs_names_; |
| 103 | 112 |
| 104 #ifndef NDEBUG | 113 #ifndef NDEBUG |
| 105 base::FilePath iphoto_xml_library_path_; | 114 base::FilePath iphoto_xml_library_path_; |
| 106 #endif | 115 #endif |
| 107 #endif // defined(OS_MACOSX) | 116 #endif // defined(OS_MACOSX) |
| 108 | 117 |
| 109 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); | 118 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); |
| 110 }; | 119 }; |
| 111 | 120 |
| 112 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ | 121 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ |
| OLD | NEW |