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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "webkit/browser/fileapi/async_file_util.h"
13 namespace file_system_provider {
15 class FileSystemInterface;
19 // The implementation of fileapi::AsyncFileUtil for provided file systems. It is
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.
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
28 // All of the methods should be called on the IO thread.
29 class ProviderAsyncFileUtil : public fileapi::AsyncFileUtil {
31 ProviderAsyncFileUtil();
32 virtual ~ProviderAsyncFileUtil();
34 // fileapi::AsyncFileUtil overrides.
35 virtual void CreateOrOpen(
36 scoped_ptr<fileapi::FileSystemOperationContext> context,
37 const fileapi::FileSystemURL& url,
39 const CreateOrOpenCallback& callback) OVERRIDE;
40 virtual void EnsureFileExists(
41 scoped_ptr<fileapi::FileSystemOperationContext> context,
42 const fileapi::FileSystemURL& url,
43 const EnsureFileExistsCallback& callback) OVERRIDE;
44 virtual void CreateDirectory(
45 scoped_ptr<fileapi::FileSystemOperationContext> context,
46 const fileapi::FileSystemURL& url,
49 const StatusCallback& callback) OVERRIDE;
50 virtual void GetFileInfo(
51 scoped_ptr<fileapi::FileSystemOperationContext> context,
52 const fileapi::FileSystemURL& url,
53 const GetFileInfoCallback& callback) OVERRIDE;
54 virtual void ReadDirectory(
55 scoped_ptr<fileapi::FileSystemOperationContext> context,
56 const fileapi::FileSystemURL& url,
57 const ReadDirectoryCallback& callback) OVERRIDE;
58 virtual void Touch(scoped_ptr<fileapi::FileSystemOperationContext> context,
59 const fileapi::FileSystemURL& url,
60 const base::Time& last_access_time,
61 const base::Time& last_modified_time,
62 const StatusCallback& callback) OVERRIDE;
63 virtual void Truncate(scoped_ptr<fileapi::FileSystemOperationContext> context,
64 const fileapi::FileSystemURL& url,
66 const StatusCallback& callback) OVERRIDE;
67 virtual void CopyFileLocal(
68 scoped_ptr<fileapi::FileSystemOperationContext> context,
69 const fileapi::FileSystemURL& src_url,
70 const fileapi::FileSystemURL& dest_url,
71 CopyOrMoveOption option,
72 const CopyFileProgressCallback& progress_callback,
73 const StatusCallback& callback) OVERRIDE;
74 virtual void MoveFileLocal(
75 scoped_ptr<fileapi::FileSystemOperationContext> context,
76 const fileapi::FileSystemURL& src_url,
77 const fileapi::FileSystemURL& dest_url,
78 CopyOrMoveOption option,
79 const StatusCallback& callback) OVERRIDE;
80 virtual void CopyInForeignFile(
81 scoped_ptr<fileapi::FileSystemOperationContext> context,
82 const base::FilePath& src_file_path,
83 const fileapi::FileSystemURL& dest_url,
84 const StatusCallback& callback) OVERRIDE;
85 virtual void DeleteFile(
86 scoped_ptr<fileapi::FileSystemOperationContext> context,
87 const fileapi::FileSystemURL& url,
88 const StatusCallback& callback) OVERRIDE;
89 virtual void DeleteDirectory(
90 scoped_ptr<fileapi::FileSystemOperationContext> context,
91 const fileapi::FileSystemURL& url,
92 const StatusCallback& callback) OVERRIDE;
93 virtual void DeleteRecursively(
94 scoped_ptr<fileapi::FileSystemOperationContext> context,
95 const fileapi::FileSystemURL& url,
96 const StatusCallback& callback) OVERRIDE;
97 virtual void CreateSnapshotFile(
98 scoped_ptr<fileapi::FileSystemOperationContext> context,
99 const fileapi::FileSystemURL& url,
100 const CreateSnapshotFileCallback& callback) OVERRIDE;
103 DISALLOW_COPY_AND_ASSIGN(ProviderAsyncFileUtil);
106 } // namespace internal
107 } // namespace file_system_provider
108 } // namespace chromeos
110 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_