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
;
16 class IPhotoDataProvider
;
18 // Presents a virtual file system containing iPhoto contents in the
19 // following organization:
22 // |- /AlbumName = An album entry by name.
23 // |- pic1.jpg = Entries for photos in the album.
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
{
34 explicit IPhotoFileUtil(MediaPathFilter
* media_path_filter
);
35 ~IPhotoFileUtil() override
;
38 // NativeMediaFileUtil overrides.
39 void GetFileInfoOnTaskRunnerThread(
40 scoped_ptr
<storage::FileSystemOperationContext
> context
,
41 const storage::FileSystemURL
& url
,
42 const GetFileInfoCallback
& callback
) override
;
43 void ReadDirectoryOnTaskRunnerThread(
44 scoped_ptr
<storage::FileSystemOperationContext
> context
,
45 const storage::FileSystemURL
& url
,
46 const ReadDirectoryCallback
& callback
) override
;
47 void CreateSnapshotFileOnTaskRunnerThread(
48 scoped_ptr
<storage::FileSystemOperationContext
> context
,
49 const storage::FileSystemURL
& url
,
50 const CreateSnapshotFileCallback
& callback
) override
;
51 base::File::Error
GetFileInfoSync(
52 storage::FileSystemOperationContext
* context
,
53 const storage::FileSystemURL
& url
,
54 base::File::Info
* file_info
,
55 base::FilePath
* platform_path
) override
;
56 base::File::Error
ReadDirectorySync(
57 storage::FileSystemOperationContext
* context
,
58 const storage::FileSystemURL
& url
,
59 EntryList
* file_list
) override
;
60 base::File::Error
DeleteDirectorySync(
61 storage::FileSystemOperationContext
* context
,
62 const storage::FileSystemURL
& url
) override
;
63 base::File::Error
DeleteFileSync(storage::FileSystemOperationContext
* context
,
64 const storage::FileSystemURL
& url
) override
;
65 base::File::Error
GetLocalFilePath(
66 storage::FileSystemOperationContext
* context
,
67 const storage::FileSystemURL
& url
,
68 base::FilePath
* local_file_path
) override
;
71 void GetFileInfoWithFreshDataProvider(
72 scoped_ptr
<storage::FileSystemOperationContext
> context
,
73 const storage::FileSystemURL
& url
,
74 const GetFileInfoCallback
& callback
,
76 void ReadDirectoryWithFreshDataProvider(
77 scoped_ptr
<storage::FileSystemOperationContext
> context
,
78 const storage::FileSystemURL
& url
,
79 const ReadDirectoryCallback
& callback
,
81 virtual void CreateSnapshotFileWithFreshDataProvider(
82 scoped_ptr
<storage::FileSystemOperationContext
> context
,
83 const storage::FileSystemURL
& url
,
84 const CreateSnapshotFileCallback
& callback
,
87 virtual IPhotoDataProvider
* GetDataProvider();
89 ImportedMediaGalleryRegistry
* imported_registry_
;
91 base::WeakPtrFactory
<IPhotoFileUtil
> weak_factory_
;
93 DISALLOW_COPY_AND_ASSIGN(IPhotoFileUtil
);
98 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_IPHOTO_FILE_UTIL_H_