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 24 matching lines...) Expand all Loading... |
35 // This callback is used by methods that report only an error code. It is | 35 // This callback is used by methods that report only an error code. It is |
36 // valid to pass NULL as the callback parameter to any function that takes a | 36 // valid to pass NULL as the callback parameter to any function that takes a |
37 // StatusCallback, in which case the operation will complete silently. | 37 // StatusCallback, in which case the operation will complete silently. |
38 // The ownership of |callback| is taken by the function and will always be | 38 // The ownership of |callback| is taken by the function and will always be |
39 // deleted by the function even on failure. | 39 // deleted by the function even on failure. |
40 typedef Callback1<PlatformFileError /* error code */>::Type StatusCallback; | 40 typedef Callback1<PlatformFileError /* error code */>::Type StatusCallback; |
41 | 41 |
42 typedef base::Callback<void(PlatformFileError /* error code */, | 42 typedef base::Callback<void(PlatformFileError /* error code */, |
43 PassPlatformFile, | 43 PassPlatformFile, |
44 bool /* created */)> CreateOrOpenCallback; | 44 bool /* created */)> CreateOrOpenCallback; |
45 typedef Callback3<PlatformFileError /* error code */, | 45 typedef base::Callback<void(PlatformFileError /* error code */, |
46 PassPlatformFile, | 46 PassPlatformFile, |
47 FilePath>::Type CreateTemporaryCallback; | 47 FilePath)> CreateTemporaryCallback; |
48 typedef Callback2<PlatformFileError /* error code */, | 48 typedef Callback2<PlatformFileError /* error code */, |
49 bool /* created */>::Type EnsureFileExistsCallback; | 49 bool /* created */>::Type EnsureFileExistsCallback; |
50 typedef Callback2<PlatformFileError /* error code */, | 50 typedef Callback2<PlatformFileError /* error code */, |
51 const PlatformFileInfo& /* file_info */ | 51 const PlatformFileInfo& /* file_info */ |
52 >::Type GetFileInfoCallback; | 52 >::Type GetFileInfoCallback; |
53 typedef Callback2<PlatformFileError /* error code */, | 53 typedef Callback2<PlatformFileError /* error code */, |
54 const std::vector<Entry>&>::Type ReadDirectoryCallback; | 54 const std::vector<Entry>&>::Type ReadDirectoryCallback; |
55 typedef Callback3<PlatformFileError /* error code */, | 55 typedef Callback3<PlatformFileError /* error code */, |
56 const char* /* data */, | 56 const char* /* data */, |
57 int /* bytes read/written */>::Type ReadCallback; | 57 int /* bytes read/written */>::Type ReadCallback; |
(...skipping 15 matching lines...) Expand all Loading... |
73 // are returned. It is invalid to pass NULL for the callback. The additional | 73 // are returned. It is invalid to pass NULL for the callback. The additional |
74 // file flags will be added on top of the default file flags which are: | 74 // file flags will be added on top of the default file flags which are: |
75 // base::PLATFORM_FILE_CREATE_ALWAYS | 75 // base::PLATFORM_FILE_CREATE_ALWAYS |
76 // base::PLATFORM_FILE_WRITE | 76 // base::PLATFORM_FILE_WRITE |
77 // base::PLATFORM_FILE_TEMPORARY. | 77 // base::PLATFORM_FILE_TEMPORARY. |
78 // Set |additional_file_flags| to 0 for synchronous writes and set to | 78 // Set |additional_file_flags| to 0 for synchronous writes and set to |
79 // base::PLATFORM_FILE_ASYNC to support asynchronous file operations. | 79 // base::PLATFORM_FILE_ASYNC to support asynchronous file operations. |
80 static bool CreateTemporary( | 80 static bool CreateTemporary( |
81 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 81 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
82 int additional_file_flags, | 82 int additional_file_flags, |
83 CreateTemporaryCallback* callback); | 83 const CreateTemporaryCallback& callback); |
84 | 84 |
85 // Close the given file handle. | 85 // Close the given file handle. |
86 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 86 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
87 PlatformFile, | 87 PlatformFile, |
88 StatusCallback* callback); | 88 StatusCallback* callback); |
89 | 89 |
90 // Ensures that the given |file_path| exist. This creates a empty new file | 90 // Ensures that the given |file_path| exist. This creates a empty new file |
91 // at |file_path| if the |file_path| does not exist. | 91 // at |file_path| if the |file_path| does not exist. |
92 // If a new file han not existed and is created at the |file_path|, | 92 // If a new file han not existed and is created at the |file_path|, |
93 // |created| of the callback argument is set true and |error code| | 93 // |created| of the callback argument is set true and |error code| |
(...skipping 127 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 |