Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / media_galleries / fileapi / iphoto_file_util.h
blob75de389caa42ea07881cec3bddef8cbfc2cf3355
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_FILEAPI_IPHOTO_FILE_UTIL_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_IPHOTO_FILE_UTIL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
12 class ImportedMediaGalleryRegistry;
14 namespace iphoto {
16 class IPhotoDataProvider;
18 // Presents a virtual file system containing iPhoto contents in the
19 // following organization:
20 // / = virtual root
21 // |- /Albums
22 // |- /AlbumName = An album entry by name.
23 // |- pic1.jpg = Entries for photos in the album.
24 // |- pic2.jpg
25 // |- /AnotherAlbum
26 // |- pic3.jpg
27 // |- /originals = A directory for originals.
28 // |- pic3.jpg = Original picture. Same name as album photo.
30 extern const char kIPhotoAlbumsDir[];
32 class IPhotoFileUtil : public NativeMediaFileUtil {
33 public:
34 explicit IPhotoFileUtil(MediaPathFilter* media_path_filter);
35 virtual ~IPhotoFileUtil();
37 protected:
38 // NativeMediaFileUtil overrides.
39 virtual void GetFileInfoOnTaskRunnerThread(
40 scoped_ptr<fileapi::FileSystemOperationContext> context,
41 const fileapi::FileSystemURL& url,
42 const GetFileInfoCallback& callback) OVERRIDE;
43 virtual void ReadDirectoryOnTaskRunnerThread(
44 scoped_ptr<fileapi::FileSystemOperationContext> context,
45 const fileapi::FileSystemURL& url,
46 const ReadDirectoryCallback& callback) OVERRIDE;
47 virtual void CreateSnapshotFileOnTaskRunnerThread(
48 scoped_ptr<fileapi::FileSystemOperationContext> context,
49 const fileapi::FileSystemURL& url,
50 const CreateSnapshotFileCallback& callback) OVERRIDE;
51 virtual base::PlatformFileError GetFileInfoSync(
52 fileapi::FileSystemOperationContext* context,
53 const fileapi::FileSystemURL& url,
54 base::PlatformFileInfo* file_info,
55 base::FilePath* platform_path) OVERRIDE;
56 virtual base::PlatformFileError ReadDirectorySync(
57 fileapi::FileSystemOperationContext* context,
58 const fileapi::FileSystemURL& url,
59 EntryList* file_list) OVERRIDE;
60 virtual base::PlatformFileError DeleteDirectorySync(
61 fileapi::FileSystemOperationContext* context,
62 const fileapi::FileSystemURL& url) OVERRIDE;
63 virtual base::PlatformFileError DeleteFileSync(
64 fileapi::FileSystemOperationContext* context,
65 const fileapi::FileSystemURL& url) OVERRIDE;
66 virtual base::PlatformFileError GetLocalFilePath(
67 fileapi::FileSystemOperationContext* context,
68 const fileapi::FileSystemURL& url,
69 base::FilePath* local_file_path) OVERRIDE;
71 private:
72 void GetFileInfoWithFreshDataProvider(
73 scoped_ptr<fileapi::FileSystemOperationContext> context,
74 const fileapi::FileSystemURL& url,
75 const GetFileInfoCallback& callback,
76 bool valid_parse);
77 void ReadDirectoryWithFreshDataProvider(
78 scoped_ptr<fileapi::FileSystemOperationContext> context,
79 const fileapi::FileSystemURL& url,
80 const ReadDirectoryCallback& callback,
81 bool valid_parse);
82 virtual void CreateSnapshotFileWithFreshDataProvider(
83 scoped_ptr<fileapi::FileSystemOperationContext> context,
84 const fileapi::FileSystemURL& url,
85 const CreateSnapshotFileCallback& callback,
86 bool valid_parse);
88 virtual IPhotoDataProvider* GetDataProvider();
90 base::WeakPtrFactory<IPhotoFileUtil> weak_factory_;
92 ImportedMediaGalleryRegistry* imported_registry_;
94 DISALLOW_COPY_AND_ASSIGN(IPhotoFileUtil);
97 } // namespace iphoto
99 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_IPHOTO_FILE_UTIL_H_