Chromium Code Reviews| Index: webkit/fileapi/media_file_system_operation.h |
| diff --git a/webkit/fileapi/media_file_system_operation.h b/webkit/fileapi/media_file_system_operation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..85a4043b28deb7ede9535ed80f4fc7c88844ce4d |
| --- /dev/null |
| +++ b/webkit/fileapi/media_file_system_operation.h |
| @@ -0,0 +1,126 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WEBKIT_FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ |
| +#define WEBKIT_FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ |
| + |
| +#include "webkit/fileapi/file_system_operation_context.h" |
| +#include "webkit/fileapi/media_file_system_proxy.h" |
| +#include "webkit/fileapi/file_system_operation_interface.h" |
| + |
| +namespace base { |
| +class Value; |
| +} |
| + |
| +namespace fileapi { |
| +class FileSystemOperation; |
| +class FileWriterDelegate; |
| + |
| +// FileSystemOperation implementation for media file systems. |
| +class MediaFileSystemOperation : public fileapi::FileSystemOperationInterface { |
| + public: |
| + virtual ~MediaFileSystemOperation(); |
| + |
| + // FileSystemOperationInterface overrides. |
| + virtual void CreateFile(const fileapi::FileSystemURL& url, |
| + bool exclusive, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void CreateDirectory(const fileapi::FileSystemURL& url, |
| + bool exclusive, |
| + bool recursive, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void Copy(const fileapi::FileSystemURL& src_url, |
| + const fileapi::FileSystemURL& dest_url, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void Move(const fileapi::FileSystemURL& src_url, |
| + const fileapi::FileSystemURL& dest_url, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void DirectoryExists(const fileapi::FileSystemURL& url, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void FileExists(const fileapi::FileSystemURL& url, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void GetMetadata(const fileapi::FileSystemURL& url, |
| + const GetMetadataCallback& callback) OVERRIDE; |
| + virtual void ReadDirectory(const fileapi::FileSystemURL& url, |
| + const ReadDirectoryCallback& callback) OVERRIDE; |
| + virtual void Remove(const fileapi::FileSystemURL& url, bool recursive, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void Write(const net::URLRequestContext* url_request_context, |
| + const fileapi::FileSystemURL& url, |
| + const GURL& blob_url, |
| + int64 offset, |
| + const WriteCallback& callback) OVERRIDE; |
| + virtual void Truncate(const fileapi::FileSystemURL& url, int64 length, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; |
| + virtual void TouchFile(const fileapi::FileSystemURL& url, |
| + const base::Time& last_access_time, |
| + const base::Time& last_modified_time, |
| + const StatusCallback& callback) OVERRIDE; |
| + virtual void OpenFile( |
| + const fileapi::FileSystemURL& url, |
| + int file_flags, |
| + base::ProcessHandle peer_handle, |
| + const OpenFileCallback& callback) OVERRIDE; |
| + virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; |
| + virtual fileapi::FileSystemOperation* AsFileSystemOperation() OVERRIDE; |
| + virtual void CreateSnapshotFile( |
| + const fileapi::FileSystemURL& url, |
| + const SnapshotFileCallback& callback) OVERRIDE; |
| + |
| + private: |
| + friend class IsolatedMountPointProvider; |
| + |
| + MediaFileSystemOperation( |
| + FileSystemContext* context, |
| + scoped_refptr<fileapi::MediaFileSystemProxyInterface> |
| + media_file_system_proxy); |
| + |
| + // Generic callback that translates platform errors to WebKit error codes. |
| + void DidDirectoryExists(const StatusCallback& callback, |
| + base::PlatformFileError rv, |
| + const base::PlatformFileInfo& file_info, |
| + const FilePath& unused); |
| + void DidFileExists(const StatusCallback& callback, |
| + base::PlatformFileError rv, |
| + const base::PlatformFileInfo& file_info, |
| + const FilePath& unused); |
| + void DidGetMetadata(const GetMetadataCallback& callback, |
| + base::PlatformFileError rv, |
| + const base::PlatformFileInfo& file_info, |
| + const FilePath& platform_path); |
| + void DidReadDirectory( |
| + const ReadDirectoryCallback& callback, |
| + base::PlatformFileError rv, |
| + const std::vector<base::FileUtilProxy::Entry>& entries, |
| + bool has_more); |
| + void DidWrite(const WriteCallback& callback, |
| + base::PlatformFileError result, |
| + int64 bytes, |
| + bool complete); |
| + void DidFinishFileOperation(const StatusCallback& callback, |
| + base::PlatformFileError rv); |
| + void DidCreateSnapshotFile( |
| + const SnapshotFileCallback& callback, |
| + base::PlatformFileError result, |
| + const base::PlatformFileInfo& file_info, |
| + const FilePath& platform_path, |
| + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
| + void DidOpenFile( |
| + const OpenFileCallback& callback, |
| + base::PlatformFileError result, |
| + base::PlatformFile file, |
| + base::ProcessHandle peer_handle); |
| + |
| + |
| + scoped_refptr<fileapi::MediaFileSystemProxyInterface> media_filesystem_proxy_; |
|
kinuko
2012/07/18 10:33:24
nit: filesystem -> file_system (though we often us
|
| +// scoped_ptr<fileapi::FileWriterDelegate> file_writer_delegate_; |
| + FileSystemOperationContext operation_context_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaFileSystemOperation); |
| +}; |
| + |
| +} // namespace |
| + |
| +#endif // WEBKIT__FILEAPI_MEDIA_fILE_SYSTEM_OPERATION_H_ |