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_ITUNES_FILE_UTIL_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_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 ITunesDataProvider
;
18 extern const char kITunesLibraryXML
[];
19 extern const char kITunesMediaDir
[];
20 extern const char kITunesMusicDir
[];
21 extern const char kITunesAutoAddDir
[];
23 class ITunesFileUtil
: public NativeMediaFileUtil
{
25 explicit ITunesFileUtil(MediaPathFilter
* media_path_filter
);
26 ~ITunesFileUtil() override
;
29 // NativeMediaFileUtil overrides.
30 void GetFileInfoOnTaskRunnerThread(
31 scoped_ptr
<storage::FileSystemOperationContext
> context
,
32 const storage::FileSystemURL
& url
,
33 const GetFileInfoCallback
& callback
) override
;
34 void ReadDirectoryOnTaskRunnerThread(
35 scoped_ptr
<storage::FileSystemOperationContext
> context
,
36 const storage::FileSystemURL
& url
,
37 const ReadDirectoryCallback
& callback
) override
;
38 void CreateSnapshotFileOnTaskRunnerThread(
39 scoped_ptr
<storage::FileSystemOperationContext
> context
,
40 const storage::FileSystemURL
& url
,
41 const CreateSnapshotFileCallback
& callback
) override
;
42 base::File::Error
GetFileInfoSync(
43 storage::FileSystemOperationContext
* context
,
44 const storage::FileSystemURL
& url
,
45 base::File::Info
* file_info
,
46 base::FilePath
* platform_path
) override
;
47 base::File::Error
ReadDirectorySync(
48 storage::FileSystemOperationContext
* context
,
49 const storage::FileSystemURL
& url
,
50 EntryList
* file_list
) override
;
51 base::File::Error
DeleteDirectorySync(
52 storage::FileSystemOperationContext
* context
,
53 const storage::FileSystemURL
& url
) override
;
54 base::File::Error
DeleteFileSync(storage::FileSystemOperationContext
* context
,
55 const storage::FileSystemURL
& url
) override
;
56 base::File::Error
CreateSnapshotFileSync(
57 storage::FileSystemOperationContext
* context
,
58 const storage::FileSystemURL
& url
,
59 base::File::Info
* file_info
,
60 base::FilePath
* platform_path
,
61 scoped_refptr
<storage::ShareableFileReference
>* file_ref
) override
;
62 base::File::Error
GetLocalFilePath(
63 storage::FileSystemOperationContext
* context
,
64 const storage::FileSystemURL
& url
,
65 base::FilePath
* local_file_path
) override
;
68 void GetFileInfoWithFreshDataProvider(
69 scoped_ptr
<storage::FileSystemOperationContext
> context
,
70 const storage::FileSystemURL
& url
,
71 const GetFileInfoCallback
& callback
,
73 void ReadDirectoryWithFreshDataProvider(
74 scoped_ptr
<storage::FileSystemOperationContext
> context
,
75 const storage::FileSystemURL
& url
,
76 const ReadDirectoryCallback
& callback
,
78 virtual void CreateSnapshotFileWithFreshDataProvider(
79 scoped_ptr
<storage::FileSystemOperationContext
> context
,
80 const storage::FileSystemURL
& url
,
81 const CreateSnapshotFileCallback
& callback
,
84 virtual ITunesDataProvider
* GetDataProvider();
86 ImportedMediaGalleryRegistry
* imported_registry_
;
88 base::WeakPtrFactory
<ITunesFileUtil
> weak_factory_
;
90 DISALLOW_COPY_AND_ASSIGN(ITunesFileUtil
);
95 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_FILE_UTIL_H_