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_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_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 drive { |
13 | 13 |
14 class FileSystemInterface; | 14 class FileSystemInterface; |
15 | 15 |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 // The implementation of fileapi::AsyncFileUtil for Drive File System. | 18 // The implementation of fileapi::AsyncFileUtil for Drive File System. |
19 class AsyncFileUtil : public fileapi::AsyncFileUtil { | 19 class AsyncFileUtil : public fileapi::AsyncFileUtil { |
20 public: | 20 public: |
21 // Callback to return the FileSystemInterface instance. This is an | 21 AsyncFileUtil(); |
22 // injecting point for testing. | |
23 // Note that the callback will be copied between threads (IO and UI), and | |
24 // will be called on UI thread. | |
25 typedef base::Callback<FileSystemInterface*()> FileSystemGetter; | |
26 | |
27 explicit AsyncFileUtil(const FileSystemGetter& file_system_getter); | |
28 virtual ~AsyncFileUtil(); | 22 virtual ~AsyncFileUtil(); |
29 | 23 |
30 // fileapi::AsyncFileUtil overrides. | 24 // fileapi::AsyncFileUtil overrides. |
31 virtual void CreateOrOpen( | 25 virtual void CreateOrOpen( |
32 scoped_ptr<fileapi::FileSystemOperationContext> context, | 26 scoped_ptr<fileapi::FileSystemOperationContext> context, |
33 const fileapi::FileSystemURL& url, | 27 const fileapi::FileSystemURL& url, |
34 int file_flags, | 28 int file_flags, |
35 const CreateOrOpenCallback& callback) OVERRIDE; | 29 const CreateOrOpenCallback& callback) OVERRIDE; |
36 virtual void EnsureFileExists( | 30 virtual void EnsureFileExists( |
37 scoped_ptr<fileapi::FileSystemOperationContext> context, | 31 scoped_ptr<fileapi::FileSystemOperationContext> context, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual void DeleteRecursively( | 85 virtual void DeleteRecursively( |
92 scoped_ptr<fileapi::FileSystemOperationContext> context, | 86 scoped_ptr<fileapi::FileSystemOperationContext> context, |
93 const fileapi::FileSystemURL& url, | 87 const fileapi::FileSystemURL& url, |
94 const StatusCallback& callback) OVERRIDE; | 88 const StatusCallback& callback) OVERRIDE; |
95 virtual void CreateSnapshotFile( | 89 virtual void CreateSnapshotFile( |
96 scoped_ptr<fileapi::FileSystemOperationContext> context, | 90 scoped_ptr<fileapi::FileSystemOperationContext> context, |
97 const fileapi::FileSystemURL& url, | 91 const fileapi::FileSystemURL& url, |
98 const CreateSnapshotFileCallback& callback) OVERRIDE; | 92 const CreateSnapshotFileCallback& callback) OVERRIDE; |
99 | 93 |
100 private: | 94 private: |
101 FileSystemGetter file_system_getter_; | |
102 | |
103 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); | 95 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); |
104 }; | 96 }; |
105 | 97 |
106 } // namespace internal | 98 } // namespace internal |
107 } // namespace drive | 99 } // namespace drive |
108 | 100 |
109 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILEAPI_ASYNC_FILE_UTIL_H_ |
OLD | NEW |