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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/drive/file_errors.h" | 8 #include "chrome/browser/chromeos/drive/file_errors.h" |
9 #include "webkit/fileapi/remote_file_system_proxy.h" | 9 #include "webkit/fileapi/remote_file_system_proxy.h" |
10 | 10 |
11 namespace fileapi { | 11 namespace fileapi { |
12 class FileSystemURL; | 12 class FileSystemURL; |
13 } | 13 } |
14 | 14 |
15 namespace drive { | 15 namespace drive { |
16 | 16 |
17 class DriveEntryProto; | 17 class DriveEntryProto; |
18 class DriveFileSystemInterface; | 18 class DriveFileSystemInterface; |
19 | 19 |
20 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; | 20 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; |
21 | 21 |
22 // Implementation of File API's remote file system proxy for Drive file system. | 22 // Implementation of File API's remote file system proxy for Drive file system. |
23 class FileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { | 23 class FileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { |
24 public: | 24 public: |
| 25 using fileapi::RemoteFileSystemProxyInterface::OpenFileCallback; |
| 26 |
25 // |file_system| is the DriveFileSystem instance owned by DriveSystemService. | 27 // |file_system| is the DriveFileSystem instance owned by DriveSystemService. |
26 explicit FileSystemProxy(DriveFileSystemInterface* file_system); | 28 explicit FileSystemProxy(DriveFileSystemInterface* file_system); |
27 | 29 |
28 // Detaches this instance from |file_system_|. | 30 // Detaches this instance from |file_system_|. |
29 // Method calls may result in no-op after calling this method. | 31 // Method calls may result in no-op after calling this method. |
30 // This method must be called on UI thread. | 32 // This method must be called on UI thread. |
31 void DetachFromFileSystem(); | 33 void DetachFromFileSystem(); |
32 | 34 |
33 // fileapi::RemoteFileSystemProxyInterface overrides. | 35 // fileapi::RemoteFileSystemProxyInterface overrides. |
34 virtual void GetFileInfo( | 36 virtual void GetFileInfo( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const fileapi::FileSystemURL& url, | 73 const fileapi::FileSystemURL& url, |
72 const fileapi::FileSystemOperation::SnapshotFileCallback& | 74 const fileapi::FileSystemOperation::SnapshotFileCallback& |
73 callback) OVERRIDE; | 75 callback) OVERRIDE; |
74 virtual void CreateWritableSnapshotFile( | 76 virtual void CreateWritableSnapshotFile( |
75 const fileapi::FileSystemURL& url, | 77 const fileapi::FileSystemURL& url, |
76 const fileapi::WritableSnapshotFile& callback) OVERRIDE; | 78 const fileapi::WritableSnapshotFile& callback) OVERRIDE; |
77 virtual void OpenFile( | 79 virtual void OpenFile( |
78 const fileapi::FileSystemURL& url, | 80 const fileapi::FileSystemURL& url, |
79 int file_flags, | 81 int file_flags, |
80 base::ProcessHandle peer_handle, | 82 base::ProcessHandle peer_handle, |
81 const fileapi::FileSystemOperation::OpenFileCallback& | 83 const OpenFileCallback& callback) OVERRIDE; |
82 callback) OVERRIDE; | |
83 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; | 84 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; |
84 virtual void TouchFile( | 85 virtual void TouchFile( |
85 const fileapi::FileSystemURL& url, | 86 const fileapi::FileSystemURL& url, |
86 const base::Time& last_access_time, | 87 const base::Time& last_access_time, |
87 const base::Time& last_modified_time, | 88 const base::Time& last_modified_time, |
88 const fileapi::FileSystemOperation::StatusCallback& callback) | 89 const fileapi::FileSystemOperation::StatusCallback& callback) |
89 OVERRIDE; | 90 OVERRIDE; |
90 | 91 |
91 protected: | 92 protected: |
92 virtual ~FileSystemProxy(); | 93 virtual ~FileSystemProxy(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const base::FilePath& virtual_path, | 170 const base::FilePath& virtual_path, |
170 const fileapi::FileSystemOperation::StatusCallback& callback, | 171 const fileapi::FileSystemOperation::StatusCallback& callback, |
171 base::PlatformFileError truncate_result); | 172 base::PlatformFileError truncate_result); |
172 | 173 |
173 // Invoked during OpenFile() operation when truncate or write flags are set. | 174 // Invoked during OpenFile() operation when truncate or write flags are set. |
174 // This is called when a local modifiable cached file is ready for such | 175 // This is called when a local modifiable cached file is ready for such |
175 // operation. | 176 // operation. |
176 void OnOpenFileForWriting( | 177 void OnOpenFileForWriting( |
177 int file_flags, | 178 int file_flags, |
178 base::ProcessHandle peer_handle, | 179 base::ProcessHandle peer_handle, |
179 const fileapi::FileSystemOperation::OpenFileCallback& callback, | 180 const OpenFileCallback& callback, |
180 FileError file_error, | 181 FileError file_error, |
181 const base::FilePath& local_cache_path); | 182 const base::FilePath& local_cache_path); |
182 | 183 |
183 // Invoked during OpenFile() operation when file create flags are set. | 184 // Invoked during OpenFile() operation when file create flags are set. |
184 void OnCreateFileForOpen( | 185 void OnCreateFileForOpen( |
185 const base::FilePath& file_path, | 186 const base::FilePath& file_path, |
186 int file_flags, | 187 int file_flags, |
187 base::ProcessHandle peer_handle, | 188 base::ProcessHandle peer_handle, |
188 const fileapi::FileSystemOperation::OpenFileCallback& callback, | 189 const OpenFileCallback& callback, |
189 FileError file_error); | 190 FileError file_error); |
190 | 191 |
191 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED | 192 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED |
192 // flag is set. This is called when the truncation of a local cache file is | 193 // flag is set. This is called when the truncation of a local cache file is |
193 // finished on FILE thread. | 194 // finished on FILE thread. |
194 void OnOpenAndTruncate( | 195 void OnOpenAndTruncate( |
195 base::ProcessHandle peer_handle, | 196 base::ProcessHandle peer_handle, |
196 const fileapi::FileSystemOperation::OpenFileCallback& callback, | 197 const OpenFileCallback& callback, |
197 base::PlatformFile* platform_file, | 198 base::PlatformFile* platform_file, |
198 base::PlatformFileError* truncate_result); | 199 base::PlatformFileError* truncate_result); |
199 | 200 |
200 DriveFileSystemInterface* file_system_; | 201 DriveFileSystemInterface* file_system_; |
201 }; | 202 }; |
202 | 203 |
203 } // namespace chromeos | 204 } // namespace chromeos |
204 | 205 |
205 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
OLD | NEW |