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