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_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // Invoked at the last step of OpenFile. It removes |file_path| from the | 260 // Invoked at the last step of OpenFile. It removes |file_path| from the |
261 // current set of opened files if |result| is an error, and then invokes the | 261 // current set of opened files if |result| is an error, and then invokes the |
262 // |callback| function. | 262 // |callback| function. |
263 void OnOpenFileFinished(const FilePath& file_path, | 263 void OnOpenFileFinished(const FilePath& file_path, |
264 const OpenFileCallback& callback, | 264 const OpenFileCallback& callback, |
265 GDataFileError result, | 265 GDataFileError result, |
266 const FilePath& cache_file_path); | 266 const FilePath& cache_file_path); |
267 | 267 |
268 // Invoked during the process of CloseFile. What is done here is as follows: | 268 // Invoked during the process of CloseFile. What is done here is as follows: |
269 // 1) Gets resource_id and md5 of the entry at |file_path|. | 269 // 1) Gets resource_id and md5 of the entry at |file_path|. |
270 // 2) Gets the local path of the cache file from resource_id and md5. | 270 // 2) Commits the modification to the cache system. |
271 // 3) Gets PlatformFileInfo of the modified local cache file. | 271 // 3) Removes the |file_path| from the remembered set of opened files. |
272 // 4) Gets GDataEntry for |file_path|. | 272 // 4) Invokes the user-supplied |callback|. |
273 // 5) Modifies GDataEntry using the new PlatformFileInfo. | |
274 // 6) Commits the modification to the cache system. | |
275 // 7) Invokes the user-supplied |callback|. | |
276 // |callback| must not be null. | 273 // |callback| must not be null. |
277 void OnGetEntryInfoCompleteForCloseFile( | 274 void CloseFileOnUIThreadAfterGetEntryInfo( |
278 const FilePath& file_path, | 275 const FilePath& file_path, |
279 const FileOperationCallback& callback, | 276 const FileOperationCallback& callback, |
280 GDataFileError error, | 277 GDataFileError error, |
281 scoped_ptr<GDataEntryProto> entry_proto); | 278 scoped_ptr<GDataEntryProto> entry_proto); |
282 void OnGetCacheFilePathCompleteForCloseFile( | 279 void CloseFileOnUIThreadAfterCommitDirtyInCache( |
283 const FilePath& file_path, | |
284 const FileOperationCallback& callback, | |
285 GDataFileError error, | |
286 const std::string& resource_id, | |
287 const std::string& md5, | |
288 const FilePath& local_cache_path); | |
289 void OnGetModifiedFileInfoCompleteForCloseFile( | |
290 const FilePath& file_path, | |
291 base::PlatformFileInfo* file_info, | |
292 bool* get_file_info_result, | |
293 const FileOperationCallback& callback); | |
294 void OnGetEntryCompleteForCloseFile( | |
295 const base::PlatformFileInfo& file_info, | |
296 const FileOperationCallback& callback, | |
297 GDataFileError error, | |
298 GDataEntry* entry); | |
299 void OnCommitDirtyInCacheCompleteForCloseFile( | |
300 const FileOperationCallback& callback, | 280 const FileOperationCallback& callback, |
301 GDataFileError error, | 281 GDataFileError error, |
302 const std::string& resource_id, | 282 const std::string& resource_id, |
303 const std::string& md5); | 283 const std::string& md5); |
304 void OnCloseFileFinished(const FilePath& file_path, | 284 void CloseFileOnUIThreadFinalize(const FilePath& file_path, |
305 const FileOperationCallback& callback, | 285 const FileOperationCallback& callback, |
306 GDataFileError result); | 286 GDataFileError result); |
307 | 287 |
308 // Invoked upon completion of GetFileByPath initiated by Copy. If | 288 // Invoked upon completion of GetFileByPath initiated by Copy. If |
309 // GetFileByPath reports no error, calls TransferRegularFile to transfer | 289 // GetFileByPath reports no error, calls TransferRegularFile to transfer |
310 // |local_file_path| to |remote_dest_file_path|. | 290 // |local_file_path| to |remote_dest_file_path|. |
311 // | 291 // |
312 // Can be called from UI thread. |callback| is run on the calling thread. | 292 // Can be called from UI thread. |callback| is run on the calling thread. |
313 void OnGetFileCompleteForCopy(const FilePath& remote_dest_file_path, | 293 void OnGetFileCompleteForCopy(const FilePath& remote_dest_file_path, |
314 const FileOperationCallback& callback, | 294 const FileOperationCallback& callback, |
315 GDataFileError error, | 295 GDataFileError error, |
316 const FilePath& local_file_path, | 296 const FilePath& local_file_path, |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 // invalidate the weak pointers before any other members are destroyed. | 846 // invalidate the weak pointers before any other members are destroyed. |
867 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 847 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
868 // Unlike other classes, we need this as we need this to redirect a task | 848 // Unlike other classes, we need this as we need this to redirect a task |
869 // from IO thread to UI thread. | 849 // from IO thread to UI thread. |
870 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 850 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
871 }; | 851 }; |
872 | 852 |
873 } // namespace gdata | 853 } // namespace gdata |
874 | 854 |
875 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 855 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |