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 <string> | 9 #include <string> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 | 15 |
16 namespace itunes { | |
17 class ITunesDataProvider; | |
18 } | |
19 | |
15 namespace picasa { | 20 namespace picasa { |
16 class PicasaDataProvider; | 21 class PicasaDataProvider; |
17 } | 22 } |
18 | 23 |
19 namespace chrome { | 24 namespace chrome { |
20 | 25 |
21 // This class lives on the MediaTaskRunner thread. It has some static | 26 // This class lives on the MediaTaskRunner thread. It has some static |
22 // methods which are called on the UI thread. | 27 // methods which are called on the UI thread. |
23 // | 28 // |
24 // MediaTaskRunner is not guaranteed to be one thread, but it is guaranteed | 29 // MediaTaskRunner is not guaranteed to be one thread, but it is guaranteed |
25 // to be a series of sequential calls. See SequencedTaskRunner for details. | 30 // to be a series of sequential calls. See SequencedTaskRunner for details. |
26 class ImportedMediaGalleryRegistry { | 31 class ImportedMediaGalleryRegistry { |
27 public: | 32 public: |
28 static ImportedMediaGalleryRegistry* GetInstance(); | 33 static ImportedMediaGalleryRegistry* GetInstance(); |
29 | 34 |
30 // Should be called on the UI thread only. | 35 // Should be called on the UI thread only. |
31 static std::string RegisterPicasaFilesystemOnUIThread( | 36 std::string RegisterPicasaFilesystemOnUIThread( |
32 const base::FilePath& database_path); | 37 const base::FilePath& database_path); |
33 static bool RevokePicasaFilesystemOnUIThread(const std::string& fsid); | 38 |
39 std::string RegisterITunesFilesystemOnUIThread( | |
40 const base::FilePath& xml_library_path); | |
41 | |
42 bool RevokeImportedFilesystemOnUIThread(const std::string& fsid); | |
34 | 43 |
35 // Should be called on the MediaTaskRunner thread only. | 44 // Should be called on the MediaTaskRunner thread only. |
36 static picasa::PicasaDataProvider* picasa_data_provider(); | 45 static picasa::PicasaDataProvider* picasa_data_provider(); |
37 | 46 |
47 static itunes::ITunesDataProvider* itunes_data_provider(); | |
48 | |
38 private: | 49 private: |
39 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; | 50 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; |
40 | 51 |
41 ImportedMediaGalleryRegistry(); | 52 ImportedMediaGalleryRegistry(); |
42 virtual ~ImportedMediaGalleryRegistry(); | 53 virtual ~ImportedMediaGalleryRegistry(); |
43 | 54 |
44 void RegisterPicasaFileSystem(const base::FilePath& database_path); | 55 void RegisterPicasaFileSystem(const base::FilePath& database_path); |
45 void RevokePicasaFileSystem(); | 56 void RevokePicasaFileSystem(); |
46 | 57 |
58 void RegisterITunesFileSystem(const base::FilePath& xml_library_path); | |
59 void RevokeITunesFileSystem(); | |
60 | |
47 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; | 61 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; |
Lei Zhang
2013/06/06 03:48:47
You should mention which variables are accessed on
vandebo (ex-Chrome)
2013/06/06 19:49:18
Done.
| |
62 std::set<std::string> picasa_fsids_; | |
48 | 63 |
49 int picasa_filesystems_count_; | 64 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_; |
65 std::set<std::string> itunes_fsids_; | |
66 | |
67 #ifndef NDEBUG | |
68 std::string picasa_database_path_; | |
Lei Zhang
2013/06/06 03:48:47
These need to be FilePaths to compile x-platform.
vandebo (ex-Chrome)
2013/06/06 19:49:18
Done.
| |
69 std::string itunes_xml_library_path_; | |
70 #endif | |
50 | 71 |
51 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); | 72 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); |
52 }; | 73 }; |
53 | 74 |
54 } // namespace chrome | 75 } // namespace chrome |
55 | 76 |
56 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ | 77 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ |
OLD | NEW |