| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file provides the core implementation of fileapi methods. | 5 // This file provides the core implementation of fileapi methods. |
| 6 // The functions should be called on UI thread. | 6 // The functions should be called on UI thread. |
| 7 // Note that most method invocation of fileapi is done on IO thread. The gap is | 7 // Note that most method invocation of fileapi is done on IO thread. The gap is |
| 8 // filled by FileSystemProxy. | 8 // filled by FileSystemProxy. |
| 9 // Also, the order of arguments for the functions which take FileSystemInterface | 9 // Also, the order of arguments for the functions which take FileSystemInterface |
| 10 // at the last is intentional. The instance of FileSystemInterface should be | 10 // at the last is intentional. The instance of FileSystemInterface should be |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const std::vector<fileapi::DirectoryEntry>& file_list, | 54 const std::vector<fileapi::DirectoryEntry>& file_list, |
| 55 bool has_more)> ReadDirectoryCallback; | 55 bool has_more)> ReadDirectoryCallback; |
| 56 typedef base::Callback< | 56 typedef base::Callback< |
| 57 void(base::PlatformFileError result, | 57 void(base::PlatformFileError result, |
| 58 const base::PlatformFileInfo& file_info, | 58 const base::PlatformFileInfo& file_info, |
| 59 const base::FilePath& snapshot_file_path, | 59 const base::FilePath& snapshot_file_path, |
| 60 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy)> | 60 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy)> |
| 61 CreateSnapshotFileCallback; | 61 CreateSnapshotFileCallback; |
| 62 typedef base::Callback< | 62 typedef base::Callback< |
| 63 void(base::PlatformFileError result, | 63 void(base::PlatformFileError result, |
| 64 const base::FilePath& snapshot_file_path)> | 64 const base::FilePath& snapshot_file_path, |
| 65 const base::Closure& on_close_callback)> |
| 65 CreateWritableSnapshotFileCallback; | 66 CreateWritableSnapshotFileCallback; |
| 66 typedef base::Callback< | 67 typedef base::Callback< |
| 67 void(base::PlatformFileError result, | 68 void(base::PlatformFileError result, |
| 68 base::PlatformFile platform_file)> OpenFileCallback; | 69 base::PlatformFile platform_file, |
| 70 const base::Closure& on_close_callback)> OpenFileCallback; |
| 69 | 71 |
| 70 // Runs |file_system_getter| to obtain the instance of FileSystemInstance, | 72 // Runs |file_system_getter| to obtain the instance of FileSystemInstance, |
| 71 // and then runs |callback| with it. | 73 // and then runs |callback| with it. |
| 72 // If |file_system_getter| returns NULL, runs |on_error_callback| instead. | 74 // If |file_system_getter| returns NULL, runs |on_error_callback| instead. |
| 73 // This function must be called on UI thread. | 75 // This function must be called on UI thread. |
| 74 // |file_system_getter| and |callback| must not be null, but | 76 // |file_system_getter| and |callback| must not be null, but |
| 75 // |on_error_callback| can be null (if no operation is necessary for error | 77 // |on_error_callback| can be null (if no operation is necessary for error |
| 76 // case). | 78 // case). |
| 77 void RunFileSystemCallback( | 79 void RunFileSystemCallback( |
| 78 const FileSystemGetter& file_system_getter, | 80 const FileSystemGetter& file_system_getter, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 const StatusCallback& callback, | 143 const StatusCallback& callback, |
| 142 FileSystemInterface* file_system); | 144 FileSystemInterface* file_system); |
| 143 | 145 |
| 144 // Creates a snapshot for the file at |file_path|. | 146 // Creates a snapshot for the file at |file_path|. |
| 145 // Called from FileSystemProxy::CreateSnapshotFile(). | 147 // Called from FileSystemProxy::CreateSnapshotFile(). |
| 146 void CreateSnapshotFile(const base::FilePath& file_path, | 148 void CreateSnapshotFile(const base::FilePath& file_path, |
| 147 const CreateSnapshotFileCallback& callback, | 149 const CreateSnapshotFileCallback& callback, |
| 148 FileSystemInterface* file_system); | 150 FileSystemInterface* file_system); |
| 149 | 151 |
| 150 // Creates a writable snapshot for the file at |file_path|. | 152 // Creates a writable snapshot for the file at |file_path|. |
| 151 // After writing operation is done, CloseFile is needed to be called. | 153 // After writing operation is done, |on_close_callback| must be called. |
| 152 void CreateWritableSnapshotFile( | 154 void CreateWritableSnapshotFile( |
| 153 const base::FilePath& file_path, | 155 const base::FilePath& file_path, |
| 154 const CreateWritableSnapshotFileCallback& callback, | 156 const CreateWritableSnapshotFileCallback& callback, |
| 155 FileSystemInterface* file_system); | 157 FileSystemInterface* file_system); |
| 156 | 158 |
| 157 // Opens the file at |file_path| with options |file_flags|. | 159 // Opens the file at |file_path| with options |file_flags|. |
| 158 // Called from FileSystemProxy::OpenFile. | 160 // Called from FileSystemProxy::OpenFile. |
| 159 void OpenFile(const base::FilePath& file_path, | 161 void OpenFile(const base::FilePath& file_path, |
| 160 int file_flags, | 162 int file_flags, |
| 161 const OpenFileCallback& callback, | 163 const OpenFileCallback& callback, |
| 162 FileSystemInterface* file_system); | 164 FileSystemInterface* file_system); |
| 163 | 165 |
| 164 // Closes the file at |file_path|. | |
| 165 // Called from FileSystemProxy::NotifyCloseFile and | |
| 166 // FileSystemProxy::CloseWRitableSnapshotFile. | |
| 167 void CloseFile(const base::FilePath& file_path, | |
| 168 FileSystemInterface* file_system); | |
| 169 | |
| 170 // Changes timestamp of the file at |file_path| to |last_access_time| and | 166 // Changes timestamp of the file at |file_path| to |last_access_time| and |
| 171 // |last_modified_time|. Called from FileSystemProxy::TouchFile(). | 167 // |last_modified_time|. Called from FileSystemProxy::TouchFile(). |
| 172 void TouchFile(const base::FilePath& file_path, | 168 void TouchFile(const base::FilePath& file_path, |
| 173 const base::Time& last_access_time, | 169 const base::Time& last_access_time, |
| 174 const base::Time& last_modified_time, | 170 const base::Time& last_modified_time, |
| 175 const StatusCallback& callback, | 171 const StatusCallback& callback, |
| 176 FileSystemInterface* file_system); | 172 FileSystemInterface* file_system); |
| 177 | 173 |
| 178 } // namespace fileapi_internal | 174 } // namespace fileapi_internal |
| 179 } // namespace drive | 175 } // namespace drive |
| 180 | 176 |
| 181 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WORKER_H_ | 177 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_WORKER_H_ |
| OLD | NEW |