OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ | 5 #ifndef WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ |
6 #define WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ | 6 #define WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "webkit/fileapi/file_system_operation.h" | 10 #include "webkit/fileapi/file_system_operation.h" |
11 | 11 |
12 namespace fileapi { | 12 namespace fileapi { |
13 | 13 |
14 typedef base::Callback< | 14 typedef base::Callback< |
15 void(base::PlatformFileError result, | 15 void(base::PlatformFileError result, |
16 const base::FilePath& platform_path, | 16 const base::FilePath& platform_path, |
17 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> | 17 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> |
18 WritableSnapshotFile; | 18 WritableSnapshotFile; |
19 | 19 |
20 // The interface class for remote file system proxy. | 20 // The interface class for remote file system proxy. |
21 class RemoteFileSystemProxyInterface : | 21 class RemoteFileSystemProxyInterface : |
22 public base::RefCountedThreadSafe<RemoteFileSystemProxyInterface> { | 22 public base::RefCountedThreadSafe<RemoteFileSystemProxyInterface> { |
23 public: | 23 public: |
| 24 // Used for OpenFile(). |result| is the return code of the operation. |
| 25 typedef base::Callback< |
| 26 void(base::PlatformFileError result, |
| 27 base::PlatformFile file, |
| 28 base::ProcessHandle peer_handle)> OpenFileCallback; |
| 29 |
| 30 |
24 // Gets the file or directory info for given|path|. | 31 // Gets the file or directory info for given|path|. |
25 virtual void GetFileInfo(const FileSystemURL& url, | 32 virtual void GetFileInfo(const FileSystemURL& url, |
26 const FileSystemOperation::GetMetadataCallback& callback) = 0; | 33 const FileSystemOperation::GetMetadataCallback& callback) = 0; |
27 | 34 |
28 // Copies a file or directory from |src_url| to |dest_url|. If | 35 // Copies a file or directory from |src_url| to |dest_url|. If |
29 // |src_url| is a directory, the contents of |src_url| are copied to | 36 // |src_url| is a directory, the contents of |src_url| are copied to |
30 // |dest_url| recursively. A new file or directory is created at | 37 // |dest_url| recursively. A new file or directory is created at |
31 // |dest_url| as needed. | 38 // |dest_url| as needed. |
32 virtual void Copy( | 39 virtual void Copy( |
33 const FileSystemURL& src_url, | 40 const FileSystemURL& src_url, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual void CreateWritableSnapshotFile( | 98 virtual void CreateWritableSnapshotFile( |
92 const FileSystemURL& url, | 99 const FileSystemURL& url, |
93 const WritableSnapshotFile& callback) = 0; | 100 const WritableSnapshotFile& callback) = 0; |
94 | 101 |
95 // Opens file for a given |url| with specified |flags| (see | 102 // Opens file for a given |url| with specified |flags| (see |
96 // base::PlatformFileFlags for details). | 103 // base::PlatformFileFlags for details). |
97 virtual void OpenFile( | 104 virtual void OpenFile( |
98 const FileSystemURL& url, | 105 const FileSystemURL& url, |
99 int flags, | 106 int flags, |
100 base::ProcessHandle peer_handle, | 107 base::ProcessHandle peer_handle, |
101 const FileSystemOperation::OpenFileCallback& callback) = 0; | 108 const OpenFileCallback& callback) = 0; |
102 | 109 |
103 // Notifies that a file opened by OpenFile (at |path|) is closed. | 110 // Notifies that a file opened by OpenFile (at |path|) is closed. |
104 virtual void NotifyCloseFile(const FileSystemURL& url) = 0; | 111 virtual void NotifyCloseFile(const FileSystemURL& url) = 0; |
105 | 112 |
106 // Modifies the timestamp of a given |url| to |last_access_time| and | 113 // Modifies the timestamp of a given |url| to |last_access_time| and |
107 // |last_modified_time|. Note that unlike 'touch' command of Linux, it | 114 // |last_modified_time|. Note that unlike 'touch' command of Linux, it |
108 // does not create a new file. | 115 // does not create a new file. |
109 virtual void TouchFile( | 116 virtual void TouchFile( |
110 const fileapi::FileSystemURL& url, | 117 const fileapi::FileSystemURL& url, |
111 const base::Time& last_access_time, | 118 const base::Time& last_access_time, |
112 const base::Time& last_modified_time, | 119 const base::Time& last_modified_time, |
113 const FileSystemOperation::StatusCallback& callback) = 0; | 120 const FileSystemOperation::StatusCallback& callback) = 0; |
114 | 121 |
115 protected: | 122 protected: |
116 friend class base::RefCountedThreadSafe<RemoteFileSystemProxyInterface>; | 123 friend class base::RefCountedThreadSafe<RemoteFileSystemProxyInterface>; |
117 virtual ~RemoteFileSystemProxyInterface() {} | 124 virtual ~RemoteFileSystemProxyInterface() {} |
118 }; | 125 }; |
119 | 126 |
120 } // namespace fileapi | 127 } // namespace fileapi |
121 | 128 |
122 #endif // WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ | 129 #endif // WEBKIT_CHROMEOS_FILEAPI_REMOTE_FILE_SYSTEM_PROXY_H_ |
OLD | NEW |