Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 | |
| 5 #ifndef WEBKIT_FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ | |
| 6 #define WEBKIT_FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ | |
| 7 | |
| 8 #include "webkit/fileapi/file_system_operation_context.h" | |
| 9 #include "webkit/fileapi/media_file_system_proxy.h" | |
| 10 #include "webkit/fileapi/file_system_operation_interface.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class Value; | |
| 14 } | |
| 15 | |
| 16 namespace fileapi { | |
| 17 class FileSystemOperation; | |
| 18 class FileWriterDelegate; | |
| 19 | |
| 20 // FileSystemOperation implementation for media file systems. | |
| 21 class MediaFileSystemOperation : public fileapi::FileSystemOperationInterface { | |
| 22 public: | |
| 23 virtual ~MediaFileSystemOperation(); | |
| 24 | |
| 25 // FileSystemOperationInterface overrides. | |
| 26 virtual void CreateFile(const fileapi::FileSystemURL& url, | |
| 27 bool exclusive, | |
| 28 const StatusCallback& callback) OVERRIDE; | |
| 29 virtual void CreateDirectory(const fileapi::FileSystemURL& url, | |
| 30 bool exclusive, | |
| 31 bool recursive, | |
| 32 const StatusCallback& callback) OVERRIDE; | |
| 33 virtual void Copy(const fileapi::FileSystemURL& src_url, | |
| 34 const fileapi::FileSystemURL& dest_url, | |
| 35 const StatusCallback& callback) OVERRIDE; | |
| 36 virtual void Move(const fileapi::FileSystemURL& src_url, | |
| 37 const fileapi::FileSystemURL& dest_url, | |
| 38 const StatusCallback& callback) OVERRIDE; | |
| 39 virtual void DirectoryExists(const fileapi::FileSystemURL& url, | |
| 40 const StatusCallback& callback) OVERRIDE; | |
| 41 virtual void FileExists(const fileapi::FileSystemURL& url, | |
| 42 const StatusCallback& callback) OVERRIDE; | |
| 43 virtual void GetMetadata(const fileapi::FileSystemURL& url, | |
| 44 const GetMetadataCallback& callback) OVERRIDE; | |
| 45 virtual void ReadDirectory(const fileapi::FileSystemURL& url, | |
| 46 const ReadDirectoryCallback& callback) OVERRIDE; | |
| 47 virtual void Remove(const fileapi::FileSystemURL& url, bool recursive, | |
| 48 const StatusCallback& callback) OVERRIDE; | |
| 49 virtual void Write(const net::URLRequestContext* url_request_context, | |
| 50 const fileapi::FileSystemURL& url, | |
| 51 const GURL& blob_url, | |
| 52 int64 offset, | |
| 53 const WriteCallback& callback) OVERRIDE; | |
| 54 virtual void Truncate(const fileapi::FileSystemURL& url, int64 length, | |
| 55 const StatusCallback& callback) OVERRIDE; | |
| 56 virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; | |
| 57 virtual void TouchFile(const fileapi::FileSystemURL& url, | |
| 58 const base::Time& last_access_time, | |
| 59 const base::Time& last_modified_time, | |
| 60 const StatusCallback& callback) OVERRIDE; | |
| 61 virtual void OpenFile( | |
| 62 const fileapi::FileSystemURL& url, | |
| 63 int file_flags, | |
| 64 base::ProcessHandle peer_handle, | |
| 65 const OpenFileCallback& callback) OVERRIDE; | |
| 66 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; | |
| 67 virtual fileapi::FileSystemOperation* AsFileSystemOperation() OVERRIDE; | |
| 68 virtual void CreateSnapshotFile( | |
| 69 const fileapi::FileSystemURL& url, | |
| 70 const SnapshotFileCallback& callback) OVERRIDE; | |
| 71 | |
| 72 private: | |
| 73 friend class IsolatedMountPointProvider; | |
| 74 | |
| 75 MediaFileSystemOperation( | |
| 76 FileSystemContext* context, | |
| 77 scoped_refptr<fileapi::MediaFileSystemProxyInterface> | |
| 78 media_file_system_proxy); | |
| 79 | |
| 80 // Generic callback that translates platform errors to WebKit error codes. | |
| 81 void DidDirectoryExists(const StatusCallback& callback, | |
| 82 base::PlatformFileError rv, | |
| 83 const base::PlatformFileInfo& file_info, | |
| 84 const FilePath& unused); | |
| 85 void DidFileExists(const StatusCallback& callback, | |
| 86 base::PlatformFileError rv, | |
| 87 const base::PlatformFileInfo& file_info, | |
| 88 const FilePath& unused); | |
| 89 void DidGetMetadata(const GetMetadataCallback& callback, | |
| 90 base::PlatformFileError rv, | |
| 91 const base::PlatformFileInfo& file_info, | |
| 92 const FilePath& platform_path); | |
| 93 void DidReadDirectory( | |
| 94 const ReadDirectoryCallback& callback, | |
| 95 base::PlatformFileError rv, | |
| 96 const std::vector<base::FileUtilProxy::Entry>& entries, | |
| 97 bool has_more); | |
| 98 void DidWrite(const WriteCallback& callback, | |
| 99 base::PlatformFileError result, | |
| 100 int64 bytes, | |
| 101 bool complete); | |
| 102 void DidFinishFileOperation(const StatusCallback& callback, | |
| 103 base::PlatformFileError rv); | |
| 104 void DidCreateSnapshotFile( | |
| 105 const SnapshotFileCallback& callback, | |
| 106 base::PlatformFileError result, | |
| 107 const base::PlatformFileInfo& file_info, | |
| 108 const FilePath& platform_path, | |
| 109 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | |
| 110 void DidOpenFile( | |
| 111 const OpenFileCallback& callback, | |
| 112 base::PlatformFileError result, | |
| 113 base::PlatformFile file, | |
| 114 base::ProcessHandle peer_handle); | |
| 115 | |
| 116 | |
| 117 scoped_refptr<fileapi::MediaFileSystemProxyInterface> media_filesystem_proxy_; | |
|
kinuko
2012/07/18 10:33:24
nit: filesystem -> file_system (though we often us
| |
| 118 // scoped_ptr<fileapi::FileWriterDelegate> file_writer_delegate_; | |
| 119 FileSystemOperationContext operation_context_; | |
| 120 | |
| 121 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemOperation); | |
| 122 }; | |
| 123 | |
| 124 } // namespace | |
| 125 | |
| 126 #endif // WEBKIT__FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ | |
| OLD | NEW |