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_api.h" | 10 #include "base/base_api.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 // for the callback. | 57 // for the callback. |
58 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 58 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
59 // a new file at the given |file_path| and calls back with | 59 // a new file at the given |file_path| and calls back with |
60 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. | 60 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. |
61 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 61 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
62 const FilePath& file_path, | 62 const FilePath& file_path, |
63 int file_flags, | 63 int file_flags, |
64 CreateOrOpenCallback* callback); | 64 CreateOrOpenCallback* callback); |
65 | 65 |
66 // Creates a temporary file for writing. The path and an open file handle | 66 // Creates a temporary file for writing. The path and an open file handle |
67 // are returned. It is invalid to pass NULL for the callback. | 67 // are returned. It is invalid to pass NULL for the callback. The additional |
68 // file flags will be added on top of the default file flags which are: | |
69 // base::PLATFORM_FILE_CREATE_ALWAYS | |
70 // base::PLATFORM_FILE_WRITE | |
71 // base::PLATFORM_FILE_TEMPORARY. | |
72 // Set |additional_file_flags| to 0 for synchronous writes and set to | |
73 // base::PLATFORM_FILE_ASYNC to support asynchronous file operations for | |
74 // net::FileStream. | |
darin (slow to review)
2011/06/11 07:00:37
nit: it is risky to refer to another module like t
noelutz
2011/06/13 16:52:08
Done.
| |
68 static bool CreateTemporary( | 75 static bool CreateTemporary( |
69 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 76 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
77 int additional_file_flags, | |
70 CreateTemporaryCallback* callback); | 78 CreateTemporaryCallback* callback); |
71 | 79 |
72 // Close the given file handle. | 80 // Close the given file handle. |
73 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 81 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
74 PlatformFile, | 82 PlatformFile, |
75 StatusCallback* callback); | 83 StatusCallback* callback); |
76 | 84 |
77 // Ensures that the given |file_path| exist. This creates a empty new file | 85 // Ensures that the given |file_path| exist. This creates a empty new file |
78 // at |file_path| if the |file_path| does not exist. | 86 // at |file_path| if the |file_path| does not exist. |
79 // If a new file han not existed and is created at the |file_path|, | 87 // If a new file han not existed and is created at the |file_path|, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 PlatformFile file, | 215 PlatformFile file, |
208 StatusCallback* callback); | 216 StatusCallback* callback); |
209 | 217 |
210 private: | 218 private: |
211 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 219 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
212 }; | 220 }; |
213 | 221 |
214 } // namespace base | 222 } // namespace base |
215 | 223 |
216 #endif // BASE_FILE_UTIL_PROXY_H_ | 224 #endif // BASE_FILE_UTIL_PROXY_H_ |
OLD | NEW |