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 virtual ~ITunesFileUtil();
29 // NativeMediaFileUtil overrides.
30 virtual void GetFileInfoOnTaskRunnerThread(
31 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
32 const fileapi::FileSystemURL
& url
,
33 const GetFileInfoCallback
& callback
) OVERRIDE
;
34 virtual void ReadDirectoryOnTaskRunnerThread(
35 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
36 const fileapi::FileSystemURL
& url
,
37 const ReadDirectoryCallback
& callback
) OVERRIDE
;
38 virtual void CreateSnapshotFileOnTaskRunnerThread(
39 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
40 const fileapi::FileSystemURL
& url
,
41 const CreateSnapshotFileCallback
& callback
) OVERRIDE
;
42 virtual base::PlatformFileError
GetFileInfoSync(
43 fileapi::FileSystemOperationContext
* context
,
44 const fileapi::FileSystemURL
& url
,
45 base::PlatformFileInfo
* file_info
,
46 base::FilePath
* platform_path
) OVERRIDE
;
47 virtual base::PlatformFileError
ReadDirectorySync(
48 fileapi::FileSystemOperationContext
* context
,
49 const fileapi::FileSystemURL
& url
,
50 EntryList
* file_list
) OVERRIDE
;
51 virtual base::PlatformFileError
DeleteDirectorySync(
52 fileapi::FileSystemOperationContext
* context
,
53 const fileapi::FileSystemURL
& url
) OVERRIDE
;
54 virtual base::PlatformFileError
DeleteFileSync(
55 fileapi::FileSystemOperationContext
* context
,
56 const fileapi::FileSystemURL
& url
) OVERRIDE
;
57 virtual base::PlatformFileError
CreateSnapshotFileSync(
58 fileapi::FileSystemOperationContext
* context
,
59 const fileapi::FileSystemURL
& url
,
60 base::PlatformFileInfo
* file_info
,
61 base::FilePath
* platform_path
,
62 scoped_refptr
<webkit_blob::ShareableFileReference
>* file_ref
) OVERRIDE
;
63 virtual base::PlatformFileError
GetLocalFilePath(
64 fileapi::FileSystemOperationContext
* context
,
65 const fileapi::FileSystemURL
& url
,
66 base::FilePath
* local_file_path
) OVERRIDE
;
69 void GetFileInfoWithFreshDataProvider(
70 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
71 const fileapi::FileSystemURL
& url
,
72 const GetFileInfoCallback
& callback
,
74 void ReadDirectoryWithFreshDataProvider(
75 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
76 const fileapi::FileSystemURL
& url
,
77 const ReadDirectoryCallback
& callback
,
79 virtual void CreateSnapshotFileWithFreshDataProvider(
80 scoped_ptr
<fileapi::FileSystemOperationContext
> context
,
81 const fileapi::FileSystemURL
& url
,
82 const CreateSnapshotFileCallback
& callback
,
85 virtual ITunesDataProvider
* GetDataProvider();
87 base::WeakPtrFactory
<ITunesFileUtil
> weak_factory_
;
89 ImportedMediaGalleryRegistry
* imported_registry_
;
91 DISALLOW_COPY_AND_ASSIGN(ITunesFileUtil
);
96 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_FILE_UTIL_H_