Chromium Code Reviews| 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. If async |
| 68 // is true the file temporary file will be opened to support asynchronuous | |
| 69 // file operations. Set async to false if you want to use | |
| 70 // FileUtilProxy::Write() on the temporary file. | |
| 68 static bool CreateTemporary( | 71 static bool CreateTemporary( |
| 69 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 72 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 73 bool aync, | |
|
darin (slow to review)
2011/06/03 17:51:45
please avoid adding bool parameters like this. it
| |
| 70 CreateTemporaryCallback* callback); | 74 CreateTemporaryCallback* callback); |
| 71 | 75 |
| 72 // Close the given file handle. | 76 // Close the given file handle. |
| 73 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 77 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 74 PlatformFile, | 78 PlatformFile, |
| 75 StatusCallback* callback); | 79 StatusCallback* callback); |
| 76 | 80 |
| 77 // Ensures that the given |file_path| exist. This creates a empty new file | 81 // Ensures that the given |file_path| exist. This creates a empty new file |
| 78 // at |file_path| if the |file_path| does not exist. | 82 // 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|, | 83 // 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, | 211 PlatformFile file, |
| 208 StatusCallback* callback); | 212 StatusCallback* callback); |
| 209 | 213 |
| 210 private: | 214 private: |
| 211 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 215 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
| 212 }; | 216 }; |
| 213 | 217 |
| 214 } // namespace base | 218 } // namespace base |
| 215 | 219 |
| 216 #endif // BASE_FILE_UTIL_PROXY_H_ | 220 #endif // BASE_FILE_UTIL_PROXY_H_ |
| OLD | NEW |