Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 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. |
| 4 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_FILE_UTIL_H_ |
| 6 | #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_FILE_UTIL_H_ |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 7 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 8 | #include "base/memory/scoped_ptr.h" |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 9 | #include "base/memory/weak_ptr.h" |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 10 | #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 11 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 12 | namespace chrome { |
| 13 | class ImportedMediaGalleryRegistry; |
| 14 | } |
| 15 | |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 16 | namespace itunes { |
| 17 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 18 | class ITunesDataProvider; |
| 19 | |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 20 | class ItunesFileUtil : public chrome::NativeMediaFileUtil { |
| 21 | public: |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 22 | explicit ItunesFileUtil(chrome::MediaPathFilter* media_path_filter); |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 23 | virtual ~ItunesFileUtil(); |
| 24 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 25 | protected: |
| 26 | // NativeMediaFileUtil overrides. |
| 27 | virtual void GetFileInfoOnTaskRunnerThread( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 28 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 29 | const fileapi::FileSystemURL& url, |
| 30 | const GetFileInfoCallback& callback) OVERRIDE; |
| 31 | virtual void ReadDirectoryOnTaskRunnerThread( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 32 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 33 | const fileapi::FileSystemURL& url, |
| 34 | const ReadDirectoryCallback& callback) OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 35 | virtual void CreateSnapshotFileOnTaskRunnerThread( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 36 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 37 | const fileapi::FileSystemURL& url, |
| 38 | const CreateSnapshotFileCallback& callback) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 39 | virtual base::PlatformFileError GetFileInfoSync( |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 40 | fileapi::FileSystemOperationContext* context, |
| 41 | const fileapi::FileSystemURL& url, |
| 42 | base::PlatformFileInfo* file_info, |
| 43 | base::FilePath* platform_path) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 44 | virtual base::PlatformFileError ReadDirectorySync( |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 45 | fileapi::FileSystemOperationContext* context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 46 | const fileapi::FileSystemURL& url, |
| 47 | EntryList* file_list) OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 48 | virtual base::PlatformFileError CreateSnapshotFileSync( |
| 49 | fileapi::FileSystemOperationContext* context, |
| 50 | const fileapi::FileSystemURL& url, |
| 51 | base::PlatformFileInfo* file_info, |
| 52 | base::FilePath* platform_path, |
| 53 | scoped_refptr<webkit_blob::ShareableFileReference>* file_ref) OVERRIDE; |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 54 | virtual base::PlatformFileError GetLocalFilePath( |
| 55 | fileapi::FileSystemOperationContext* context, |
| 56 | const fileapi::FileSystemURL& url, |
| 57 | base::FilePath* local_file_path) OVERRIDE; |
| 58 | |
| 59 | private: |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 60 | void GetFileInfoWithFreshDataProvider( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 61 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 62 | const fileapi::FileSystemURL& url, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 63 | const GetFileInfoCallback& callback, |
| 64 | bool valid_parse); |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 65 | void ReadDirectoryWithFreshDataProvider( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 66 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 67 | const fileapi::FileSystemURL& url, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 68 | const ReadDirectoryCallback& callback, |
| 69 | bool valid_parse); |
| 70 | virtual void CreateSnapshotFileWithFreshDataProvider( |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 71 | scoped_ptr<fileapi::FileSystemOperationContext> context, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 72 | const fileapi::FileSystemURL& url, |
| 73 | const CreateSnapshotFileCallback& callback, |
| 74 | bool valid_parse); |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 75 | |
| 76 | ITunesDataProvider* GetDataProvider(); |
| 77 | |
| 78 | base::WeakPtrFactory<ItunesFileUtil> weak_factory_; |
| 79 | |
| 80 | chrome::ImportedMediaGalleryRegistry* imported_registry_; |
| 81 | |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 82 | DISALLOW_COPY_AND_ASSIGN(ItunesFileUtil); |
| 83 | }; |
| 84 | |
| 85 | } // namespace itunes |
| 86 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 87 | #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_FILE_UTIL_H_ |