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 "storage/browser/fileapi/async_file_util.h"
13 namespace file_system_provider
{
15 class FileSystemInterface
;
17 // TODO(mtomasz): Remove this namespace.
20 // The implementation of storage::AsyncFileUtil for provided file systems. It is
21 // created one per Chrome process. It is responsible for routing calls to the
22 // correct profile, and then to the correct profided file system.
24 // This class should be called AsyncFileUtil, without the Provided prefix. This
25 // is impossible, though because of GYP limitations. There must not be two files
26 // with the same name in a Chromium tree.
27 // See: https://code.google.com/p/gyp/issues/detail?id=384
29 // All of the methods should be called on the IO thread.
30 class ProviderAsyncFileUtil
: public storage::AsyncFileUtil
{
32 ProviderAsyncFileUtil();
33 ~ProviderAsyncFileUtil() override
;
35 // storage::AsyncFileUtil overrides.
36 void CreateOrOpen(scoped_ptr
<storage::FileSystemOperationContext
> context
,
37 const storage::FileSystemURL
& url
,
39 const CreateOrOpenCallback
& callback
) override
;
40 void EnsureFileExists(scoped_ptr
<storage::FileSystemOperationContext
> context
,
41 const storage::FileSystemURL
& url
,
42 const EnsureFileExistsCallback
& callback
) override
;
43 void CreateDirectory(scoped_ptr
<storage::FileSystemOperationContext
> context
,
44 const storage::FileSystemURL
& url
,
47 const StatusCallback
& callback
) override
;
48 void GetFileInfo(scoped_ptr
<storage::FileSystemOperationContext
> context
,
49 const storage::FileSystemURL
& url
,
50 const GetFileInfoCallback
& callback
) override
;
51 void ReadDirectory(scoped_ptr
<storage::FileSystemOperationContext
> context
,
52 const storage::FileSystemURL
& url
,
53 const ReadDirectoryCallback
& callback
) override
;
54 void Touch(scoped_ptr
<storage::FileSystemOperationContext
> context
,
55 const storage::FileSystemURL
& url
,
56 const base::Time
& last_access_time
,
57 const base::Time
& last_modified_time
,
58 const StatusCallback
& callback
) override
;
59 void Truncate(scoped_ptr
<storage::FileSystemOperationContext
> context
,
60 const storage::FileSystemURL
& url
,
62 const StatusCallback
& callback
) override
;
63 void CopyFileLocal(scoped_ptr
<storage::FileSystemOperationContext
> context
,
64 const storage::FileSystemURL
& src_url
,
65 const storage::FileSystemURL
& dest_url
,
66 CopyOrMoveOption option
,
67 const CopyFileProgressCallback
& progress_callback
,
68 const StatusCallback
& callback
) override
;
69 void MoveFileLocal(scoped_ptr
<storage::FileSystemOperationContext
> context
,
70 const storage::FileSystemURL
& src_url
,
71 const storage::FileSystemURL
& dest_url
,
72 CopyOrMoveOption option
,
73 const StatusCallback
& callback
) override
;
74 void CopyInForeignFile(
75 scoped_ptr
<storage::FileSystemOperationContext
> context
,
76 const base::FilePath
& src_file_path
,
77 const storage::FileSystemURL
& dest_url
,
78 const StatusCallback
& callback
) override
;
79 void DeleteFile(scoped_ptr
<storage::FileSystemOperationContext
> context
,
80 const storage::FileSystemURL
& url
,
81 const StatusCallback
& callback
) override
;
82 void DeleteDirectory(scoped_ptr
<storage::FileSystemOperationContext
> context
,
83 const storage::FileSystemURL
& url
,
84 const StatusCallback
& callback
) override
;
85 void DeleteRecursively(
86 scoped_ptr
<storage::FileSystemOperationContext
> context
,
87 const storage::FileSystemURL
& url
,
88 const StatusCallback
& callback
) override
;
89 void CreateSnapshotFile(
90 scoped_ptr
<storage::FileSystemOperationContext
> context
,
91 const storage::FileSystemURL
& url
,
92 const CreateSnapshotFileCallback
& callback
) override
;
95 DISALLOW_COPY_AND_ASSIGN(ProviderAsyncFileUtil
);
98 } // namespace internal
99 } // namespace file_system_provider
100 } // namespace chromeos
102 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_