OLD | NEW |
1 // Copyright 2013 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_ASYNC_FILE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_ASYNC_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_ASYNC_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_ASYNC_UTIL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/callback.h" | |
10 #include "webkit/browser/fileapi/async_file_util.h" | 8 #include "webkit/browser/fileapi/async_file_util.h" |
11 | 9 |
12 namespace drive { | 10 namespace local_discovery { |
13 | 11 |
14 class FileSystemInterface; | 12 class PrivetFileSystemAsyncUtil : public fileapi::AsyncFileUtil { |
15 | |
16 namespace internal { | |
17 | |
18 // The implementation of fileapi::AsyncFileUtil for Drive File System. | |
19 class AsyncFileUtil : public fileapi::AsyncFileUtil { | |
20 public: | 13 public: |
21 // Callback to return the FileSystemInterface instance. This is an | |
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(); | |
29 | |
30 // fileapi::AsyncFileUtil overrides. | |
31 virtual void CreateOrOpen( | 14 virtual void CreateOrOpen( |
32 scoped_ptr<fileapi::FileSystemOperationContext> context, | 15 scoped_ptr<fileapi::FileSystemOperationContext> context, |
33 const fileapi::FileSystemURL& url, | 16 const fileapi::FileSystemURL& url, |
34 int file_flags, | 17 int file_flags, |
35 const CreateOrOpenCallback& callback) OVERRIDE; | 18 const CreateOrOpenCallback& callback) OVERRIDE; |
36 virtual void EnsureFileExists( | 19 virtual void EnsureFileExists( |
37 scoped_ptr<fileapi::FileSystemOperationContext> context, | 20 scoped_ptr<fileapi::FileSystemOperationContext> context, |
38 const fileapi::FileSystemURL& url, | 21 const fileapi::FileSystemURL& url, |
39 const EnsureFileExistsCallback& callback) OVERRIDE; | 22 const EnsureFileExistsCallback& callback) OVERRIDE; |
40 virtual void CreateDirectory( | 23 virtual void CreateDirectory( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const fileapi::FileSystemURL& url, | 72 const fileapi::FileSystemURL& url, |
90 const StatusCallback& callback) OVERRIDE; | 73 const StatusCallback& callback) OVERRIDE; |
91 virtual void DeleteRecursively( | 74 virtual void DeleteRecursively( |
92 scoped_ptr<fileapi::FileSystemOperationContext> context, | 75 scoped_ptr<fileapi::FileSystemOperationContext> context, |
93 const fileapi::FileSystemURL& url, | 76 const fileapi::FileSystemURL& url, |
94 const StatusCallback& callback) OVERRIDE; | 77 const StatusCallback& callback) OVERRIDE; |
95 virtual void CreateSnapshotFile( | 78 virtual void CreateSnapshotFile( |
96 scoped_ptr<fileapi::FileSystemOperationContext> context, | 79 scoped_ptr<fileapi::FileSystemOperationContext> context, |
97 const fileapi::FileSystemURL& url, | 80 const fileapi::FileSystemURL& url, |
98 const CreateSnapshotFileCallback& callback) OVERRIDE; | 81 const CreateSnapshotFileCallback& callback) OVERRIDE; |
99 | |
100 private: | |
101 FileSystemGetter file_system_getter_; | |
102 | |
103 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); | |
104 }; | 82 }; |
105 | 83 |
106 } // namespace internal | 84 } // namespace local_discovery |
107 } // namespace drive | |
108 | 85 |
109 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_ASYNC_FILE_UTIL_H_ | 86 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_ASYNC_UTIL_H
_ |
OLD | NEW |