OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_FILES_FILE_UTIL_PROXY_H_ | 5 #ifndef BASE_FILES_FILE_UTIL_PROXY_H_ |
6 #define BASE_FILES_FILE_UTIL_PROXY_H_ | 6 #define BASE_FILES_FILE_UTIL_PROXY_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Does the same as GetFileInfo but takes PlatformFile instead of FilePath. | 89 // Does the same as GetFileInfo but takes PlatformFile instead of FilePath. |
90 // This returns false if task posting to |task_runner| has failed. | 90 // This returns false if task posting to |task_runner| has failed. |
91 static bool GetFileInfoFromPlatformFile( | 91 static bool GetFileInfoFromPlatformFile( |
92 TaskRunner* task_runner, | 92 TaskRunner* task_runner, |
93 PlatformFile file, | 93 PlatformFile file, |
94 const GetFileInfoCallback& callback); | 94 const GetFileInfoCallback& callback); |
95 | 95 |
96 // Deletes a file or a directory. | 96 // Deletes a file or a directory. |
97 // It is an error to delete a non-empty directory with recursive=false. | 97 // It is an error to delete a non-empty directory with recursive=false. |
98 // This returns false if task posting to |task_runner| has failed. | 98 // This returns false if task posting to |task_runner| has failed. |
99 static bool Delete(TaskRunner* task_runner, | 99 static bool DeleteFile(TaskRunner* task_runner, |
100 const FilePath& file_path, | 100 const FilePath& file_path, |
101 bool recursive, | 101 bool recursive, |
102 const StatusCallback& callback); | 102 const StatusCallback& callback); |
103 | |
104 // Deletes a directory and all of its contents. | |
105 // This returns false if task posting to |task_runner| has failed. | |
106 static bool RecursiveDelete( | |
107 TaskRunner* task_runner, | |
108 const FilePath& file_path, | |
109 const StatusCallback& callback); | |
110 | 103 |
111 // Reads from a file. On success, the file pointer is moved to position | 104 // Reads from a file. On success, the file pointer is moved to position |
112 // |offset + bytes_to_read| in the file. The callback can be null. | 105 // |offset + bytes_to_read| in the file. The callback can be null. |
113 // | 106 // |
114 // This returns false if |bytes_to_read| is less than zero, or | 107 // This returns false if |bytes_to_read| is less than zero, or |
115 // if task posting to |task_runner| has failed. | 108 // if task posting to |task_runner| has failed. |
116 static bool Read( | 109 static bool Read( |
117 TaskRunner* task_runner, | 110 TaskRunner* task_runner, |
118 PlatformFile file, | 111 PlatformFile file, |
119 int64 offset, | 112 int64 offset, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 PlatformFile, | 186 PlatformFile, |
194 const StatusCallback& callback); | 187 const StatusCallback& callback); |
195 | 188 |
196 private: | 189 private: |
197 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 190 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
198 }; | 191 }; |
199 | 192 |
200 } // namespace base | 193 } // namespace base |
201 | 194 |
202 #endif // BASE_FILES_FILE_UTIL_PROXY_H_ | 195 #endif // BASE_FILES_FILE_UTIL_PROXY_H_ |
OLD | NEW |