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

Side by Side Diff: chrome/browser/media_galleries/imported_media_gallery_registry.h

Issue 16158004: iTunes file util and data provider for media galleries (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo incorrect fix Created 7 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 #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* PicasaDataProvider();
46 static itunes::ITunesDataProvider* ITunesDataProvider();
37 47
38 private: 48 private:
39 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; 49 friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>;
40 50
41 ImportedMediaGalleryRegistry(); 51 ImportedMediaGalleryRegistry();
42 virtual ~ImportedMediaGalleryRegistry(); 52 virtual ~ImportedMediaGalleryRegistry();
43 53
44 void RegisterPicasaFileSystem(const base::FilePath& database_path); 54 void RegisterPicasaFileSystem(const base::FilePath& database_path);
45 void RevokePicasaFileSystem(); 55 void RevokePicasaFileSystem();
46 56
57 void RegisterITunesFileSystem(const base::FilePath& xml_library_path);
58 void RevokeITunesFileSystem();
59
60 // The data providers are only set or accessed on the task runner thread.
47 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_; 61 scoped_ptr<picasa::PicasaDataProvider> picasa_data_provider_;
62 scoped_ptr<itunes::ITunesDataProvider> itunes_data_provider_;
48 63
49 int picasa_filesystems_count_; 64 // The remaining members are only accessed on the IO thread.
tommycli 2013/06/10 17:33:25 Nice. This is better.
65 std::set<std::string> picasa_fsids_;
66 std::set<std::string> itunes_fsids_;
67
68 #ifndef NDEBUG
69 base::FilePath picasa_database_path_;
70 base::FilePath itunes_xml_library_path_;
71 #endif
50 72
51 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry); 73 DISALLOW_COPY_AND_ASSIGN(ImportedMediaGalleryRegistry);
52 }; 74 };
53 75
54 } // namespace chrome 76 } // namespace chrome
55 77
56 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_ 78 #endif // CHROME_BROWSER_MEDIA_GALLERIES_IMPORTED_MEDIA_GALLERY_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698