OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_UTIL_PROXY_H_ | 5 #ifndef BASE_FILE_UTIL_PROXY_H_ |
6 #define BASE_FILE_UTIL_PROXY_H_ | 6 #define BASE_FILE_UTIL_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 typedef base::Callback<void(PlatformFileError /* error code */, | 45 typedef base::Callback<void(PlatformFileError /* error code */, |
46 PassPlatformFile, | 46 PassPlatformFile, |
47 FilePath)> CreateTemporaryCallback; | 47 FilePath)> CreateTemporaryCallback; |
48 typedef base::Callback<void(PlatformFileError /* error code */, | 48 typedef base::Callback<void(PlatformFileError /* error code */, |
49 bool /* created */)> EnsureFileExistsCallback; | 49 bool /* created */)> EnsureFileExistsCallback; |
50 typedef base::Callback<void(PlatformFileError /* error code */, | 50 typedef base::Callback<void(PlatformFileError /* error code */, |
51 const PlatformFileInfo& /* file_info */)> | 51 const PlatformFileInfo& /* file_info */)> |
52 GetFileInfoCallback; | 52 GetFileInfoCallback; |
53 typedef base::Callback<void(PlatformFileError /* error code */, | 53 typedef base::Callback<void(PlatformFileError /* error code */, |
54 const std::vector<Entry>&)> ReadDirectoryCallback; | 54 const std::vector<Entry>&)> ReadDirectoryCallback; |
55 typedef Callback3<PlatformFileError /* error code */, | 55 typedef base::Callback<void(PlatformFileError /* error code */, |
56 const char* /* data */, | 56 const char* /* data */, |
57 int /* bytes read/written */>::Type ReadCallback; | 57 int /* bytes read/written */)> ReadCallback; |
58 typedef Callback2<PlatformFileError /* error code */, | 58 typedef Callback2<PlatformFileError /* error code */, |
59 int /* bytes written */>::Type WriteCallback; | 59 int /* bytes written */>::Type WriteCallback; |
60 | 60 |
61 // Creates or opens a file with the given flags. It is invalid to pass NULL | 61 // Creates or opens a file with the given flags. It is invalid to pass NULL |
62 // for the callback. | 62 // for the callback. |
63 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 63 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
64 // a new file at the given |file_path| and calls back with | 64 // a new file at the given |file_path| and calls back with |
65 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. | 65 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. |
66 // Takes ownership of |callback| and will delete it even on failure. | 66 // Takes ownership of |callback| and will delete it even on failure. |
67 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 67 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 bool recursive, | 154 bool recursive, |
155 StatusCallback* callback); | 155 StatusCallback* callback); |
156 | 156 |
157 // Deletes a directory and all of its contents. | 157 // Deletes a directory and all of its contents. |
158 static bool RecursiveDelete( | 158 static bool RecursiveDelete( |
159 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 159 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
160 const FilePath& file_path, | 160 const FilePath& file_path, |
161 StatusCallback* callback); | 161 StatusCallback* callback); |
162 | 162 |
163 // Reads from a file. On success, the file pointer is moved to position | 163 // Reads from a file. On success, the file pointer is moved to position |
164 // |offset + bytes_to_read| in the file. The callback can be NULL. | 164 // |offset + bytes_to_read| in the file. The callback can be NULL. |
csilv
2011/10/17 19:46:16
Technically the callback can't be NULL.... so mybe
James Hawkins
2011/10/17 20:10:17
Changed it to read "null".
| |
165 static bool Read( | 165 static bool Read( |
166 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 166 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
167 PlatformFile file, | 167 PlatformFile file, |
168 int64 offset, | 168 int64 offset, |
169 int bytes_to_read, | 169 int bytes_to_read, |
170 ReadCallback* callback); | 170 const ReadCallback& callback); |
171 | 171 |
172 // Writes to a file. If |offset| is greater than the length of the file, | 172 // Writes to a file. If |offset| is greater than the length of the file, |
173 // |false| is returned. On success, the file pointer is moved to position | 173 // |false| is returned. On success, the file pointer is moved to position |
174 // |offset + bytes_to_write| in the file. The callback can be NULL. | 174 // |offset + bytes_to_write| in the file. The callback can be NULL. |
175 // |bytes_to_write| must be greater than zero. | 175 // |bytes_to_write| must be greater than zero. |
176 static bool Write( | 176 static bool Write( |
177 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 177 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
178 PlatformFile file, | 178 PlatformFile file, |
179 int64 offset, | 179 int64 offset, |
180 const char* buffer, | 180 const char* buffer, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 PlatformFile file, | 221 PlatformFile file, |
222 StatusCallback* callback); | 222 StatusCallback* callback); |
223 | 223 |
224 private: | 224 private: |
225 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 225 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
226 }; | 226 }; |
227 | 227 |
228 } // namespace base | 228 } // namespace base |
229 | 229 |
230 #endif // BASE_FILE_UTIL_PROXY_H_ | 230 #endif // BASE_FILE_UTIL_PROXY_H_ |
OLD | NEW |