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_PROXY_H_ |
| 6 #define WEBKIT_FILEAPI_MEDIA_FILE_SYSTEM_PROXY_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "webkit/fileapi/file_system_operation_interface.h" |
| 11 |
| 12 class GURL; |
| 13 |
| 14 namespace fileapi { |
| 15 |
| 16 class FileSystemOperationContext; |
| 17 |
| 18 // The interface class for media file system proxy. |
| 19 class MediaFileSystemProxyInterface : |
| 20 public base::RefCountedThreadSafe<MediaFileSystemProxyInterface> { |
| 21 public: |
| 22 // Gets the file or directory info for given|path|. |
| 23 virtual void GetFileInfo(const FileSystemURL& url, |
| 24 const FileSystemOperationInterface::GetMetadataCallback& callback) = 0; |
| 25 |
| 26 // Copies a file or directory from |src_url| to |dest_url|. If |
| 27 // |src_url| is a directory, the contents of |src_url| are copied to |
| 28 // |dest_url| recursively. A new file or directory is created at |
| 29 // |dest_url| as needed. |
| 30 virtual void Copy( |
| 31 const FileSystemURL& src_url, |
| 32 const FileSystemURL& dest_url, |
| 33 const FileSystemOperationInterface::StatusCallback& callback) = 0; |
| 34 |
| 35 // Moves a file or directory from |src_url| to |dest_url|. A new file |
| 36 // or directory is created at |dest_url| as needed. |
| 37 virtual void Move( |
| 38 const FileSystemURL& src_url, |
| 39 const FileSystemURL& dest_url, |
| 40 const FileSystemOperationInterface::StatusCallback& callback) = 0; |
| 41 |
| 42 // Reads contents of a directory at |url|. |
| 43 virtual void ReadDirectory( |
| 44 FileSystemOperationContext* context, |
| 45 const FileSystemURL& url, |
| 46 const FileSystemOperationInterface::ReadDirectoryCallback& callback) = 0; |
| 47 |
| 48 // Removes a file or directory at |url|. If |recursive| is true, remove |
| 49 // all files and directories under the directory at |url| recursively. |
| 50 virtual void Remove(const FileSystemURL& url, bool recursive, |
| 51 const FileSystemOperationInterface::StatusCallback& callback) = 0; |
| 52 |
| 53 // Creates a directory at |url|. If |exclusive| is true, an error is |
| 54 // raised in case a directory is already present at the URL. If |
| 55 // |recursive| is true, create parent directories as needed just like |
| 56 // mkdir -p does. |
| 57 virtual void CreateDirectory( |
| 58 const FileSystemURL& url, |
| 59 bool exclusive, |
| 60 bool recursive, |
| 61 const FileSystemOperationInterface::StatusCallback& callback) = 0; |
| 62 |
| 63 // Creates a file at |url|. If the flag |is_exclusive| is true, an |
| 64 // error is raised when a file already exists at the path. It is |
| 65 // an error if a directory or a hosted document is already present at the |
| 66 // path, or the parent directory of the path is not present yet. |
| 67 virtual void CreateFile( |
| 68 const FileSystemURL& url, |
| 69 bool exclusive, |
| 70 const FileSystemOperationInterface::StatusCallback& callback) = 0; |
| 71 |
| 72 // Opens file for a give |url| with specified |flags| (see |
| 73 // base::PlatformFileFlags for details). |
| 74 virtual void OpenFile( |
| 75 const FileSystemURL& url, |
| 76 int flags, |
| 77 base::ProcessHandle peer_handle, |
| 78 const FileSystemOperationInterface::OpenFileCallback& callback) = 0; |
| 79 |
| 80 // Notifies that a file opened by OpenFile (at |path|) is closed. |
| 81 virtual void NotifyCloseFile(const FileSystemURL& url) = 0; |
| 82 |
| 83 protected: |
| 84 friend class base::RefCountedThreadSafe<MediaFileSystemProxyInterface>; |
| 85 virtual ~MediaFileSystemProxyInterface() {} |
| 86 }; |
| 87 |
| 88 } // namespace fileapi |
| 89 |
| 90 #endif // WEBKIT_FILEAPI_MEDIA_FILE_SYSTEM_PROXY_H_ |
OLD | NEW |