| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FILEAPI_ASYNC_FILE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE
_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE
_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "webkit/browser/fileapi/async_file_util.h" | 10 #include "webkit/browser/fileapi/async_file_util.h" |
| 11 | 11 |
| 12 namespace drive { | 12 namespace chromeos { |
| 13 namespace file_system_provider { |
| 13 | 14 |
| 14 class FileSystemInterface; | 15 class FileSystemInterface; |
| 15 | 16 |
| 16 namespace internal { | 17 namespace internal { |
| 17 | 18 |
| 18 // The implementation of fileapi::AsyncFileUtil for Drive File System. | 19 // The implementation of fileapi::AsyncFileUtil for provided file systems. It is |
| 19 class AsyncFileUtil : public fileapi::AsyncFileUtil { | 20 // created one per Chrome process. It is responsible for routing calls to the |
| 21 // correct profile, and then to the correct profided file system. |
| 22 // |
| 23 // This class should be called AsyncFileUtil, without the Provided prefix. This |
| 24 // is impossible, though because of GYP limitations. There must not be two files |
| 25 // with the same name in a Chromium tree. |
| 26 // See: https://code.google.com/p/gyp/issues/detail?id=384 |
| 27 // |
| 28 // All of the methods should be called on the IO thread. |
| 29 class ProviderAsyncFileUtil : public fileapi::AsyncFileUtil { |
| 20 public: | 30 public: |
| 21 AsyncFileUtil(); | 31 ProviderAsyncFileUtil(); |
| 22 virtual ~AsyncFileUtil(); | 32 virtual ~ProviderAsyncFileUtil(); |
| 23 | 33 |
| 24 // fileapi::AsyncFileUtil overrides. | 34 // fileapi::AsyncFileUtil overrides. |
| 25 virtual void CreateOrOpen( | 35 virtual void CreateOrOpen( |
| 26 scoped_ptr<fileapi::FileSystemOperationContext> context, | 36 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 27 const fileapi::FileSystemURL& url, | 37 const fileapi::FileSystemURL& url, |
| 28 int file_flags, | 38 int file_flags, |
| 29 const CreateOrOpenCallback& callback) OVERRIDE; | 39 const CreateOrOpenCallback& callback) OVERRIDE; |
| 30 virtual void EnsureFileExists( | 40 virtual void EnsureFileExists( |
| 31 scoped_ptr<fileapi::FileSystemOperationContext> context, | 41 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 32 const fileapi::FileSystemURL& url, | 42 const fileapi::FileSystemURL& url, |
| 33 const EnsureFileExistsCallback& callback) OVERRIDE; | 43 const EnsureFileExistsCallback& callback) OVERRIDE; |
| 34 virtual void CreateDirectory( | 44 virtual void CreateDirectory( |
| 35 scoped_ptr<fileapi::FileSystemOperationContext> context, | 45 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 36 const fileapi::FileSystemURL& url, | 46 const fileapi::FileSystemURL& url, |
| 37 bool exclusive, | 47 bool exclusive, |
| 38 bool recursive, | 48 bool recursive, |
| 39 const StatusCallback& callback) OVERRIDE; | 49 const StatusCallback& callback) OVERRIDE; |
| 40 virtual void GetFileInfo( | 50 virtual void GetFileInfo( |
| 41 scoped_ptr<fileapi::FileSystemOperationContext> context, | 51 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 42 const fileapi::FileSystemURL& url, | 52 const fileapi::FileSystemURL& url, |
| 43 const GetFileInfoCallback& callback) OVERRIDE; | 53 const GetFileInfoCallback& callback) OVERRIDE; |
| 44 virtual void ReadDirectory( | 54 virtual void ReadDirectory( |
| 45 scoped_ptr<fileapi::FileSystemOperationContext> context, | 55 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 46 const fileapi::FileSystemURL& url, | 56 const fileapi::FileSystemURL& url, |
| 47 const ReadDirectoryCallback& callback) OVERRIDE; | 57 const ReadDirectoryCallback& callback) OVERRIDE; |
| 48 virtual void Touch( | 58 virtual void Touch(scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 49 scoped_ptr<fileapi::FileSystemOperationContext> context, | 59 const fileapi::FileSystemURL& url, |
| 50 const fileapi::FileSystemURL& url, | 60 const base::Time& last_access_time, |
| 51 const base::Time& last_access_time, | 61 const base::Time& last_modified_time, |
| 52 const base::Time& last_modified_time, | 62 const StatusCallback& callback) OVERRIDE; |
| 53 const StatusCallback& callback) OVERRIDE; | 63 virtual void Truncate(scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 54 virtual void Truncate( | 64 const fileapi::FileSystemURL& url, |
| 55 scoped_ptr<fileapi::FileSystemOperationContext> context, | 65 int64 length, |
| 56 const fileapi::FileSystemURL& url, | 66 const StatusCallback& callback) OVERRIDE; |
| 57 int64 length, | |
| 58 const StatusCallback& callback) OVERRIDE; | |
| 59 virtual void CopyFileLocal( | 67 virtual void CopyFileLocal( |
| 60 scoped_ptr<fileapi::FileSystemOperationContext> context, | 68 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 61 const fileapi::FileSystemURL& src_url, | 69 const fileapi::FileSystemURL& src_url, |
| 62 const fileapi::FileSystemURL& dest_url, | 70 const fileapi::FileSystemURL& dest_url, |
| 63 CopyOrMoveOption option, | 71 CopyOrMoveOption option, |
| 64 const CopyFileProgressCallback& progress_callback, | 72 const CopyFileProgressCallback& progress_callback, |
| 65 const StatusCallback& callback) OVERRIDE; | 73 const StatusCallback& callback) OVERRIDE; |
| 66 virtual void MoveFileLocal( | 74 virtual void MoveFileLocal( |
| 67 scoped_ptr<fileapi::FileSystemOperationContext> context, | 75 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 68 const fileapi::FileSystemURL& src_url, | 76 const fileapi::FileSystemURL& src_url, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 virtual void DeleteRecursively( | 93 virtual void DeleteRecursively( |
| 86 scoped_ptr<fileapi::FileSystemOperationContext> context, | 94 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 87 const fileapi::FileSystemURL& url, | 95 const fileapi::FileSystemURL& url, |
| 88 const StatusCallback& callback) OVERRIDE; | 96 const StatusCallback& callback) OVERRIDE; |
| 89 virtual void CreateSnapshotFile( | 97 virtual void CreateSnapshotFile( |
| 90 scoped_ptr<fileapi::FileSystemOperationContext> context, | 98 scoped_ptr<fileapi::FileSystemOperationContext> context, |
| 91 const fileapi::FileSystemURL& url, | 99 const fileapi::FileSystemURL& url, |
| 92 const CreateSnapshotFileCallback& callback) OVERRIDE; | 100 const CreateSnapshotFileCallback& callback) OVERRIDE; |
| 93 | 101 |
| 94 private: | 102 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); | 103 DISALLOW_COPY_AND_ASSIGN(ProviderAsyncFileUtil); |
| 96 }; | 104 }; |
| 97 | 105 |
| 98 } // namespace internal | 106 } // namespace internal |
| 99 } // namespace drive | 107 } // namespace file_system_provider |
| 108 } // namespace chromeos |
| 100 | 109 |
| 101 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ | 110 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_F
ILE_UTIL_H_ |
| OLD | NEW |