OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/callback.h" | 10 #include "base/callback.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "base/tracked_objects.h" | 15 #include "base/tracked_objects.h" |
16 | 16 |
17 namespace file_util { | |
18 struct FileInfo; | |
19 } | |
20 | |
21 namespace base { | 17 namespace base { |
22 | 18 |
23 namespace file_util_proxy { | 19 namespace file_util_proxy { |
24 // Holds metadata for file or directory entry. | 20 // Holds metadata for file or directory entry. |
25 struct Entry { | 21 struct Entry { |
26 FilePath::StringType name; | 22 FilePath::StringType name; |
27 bool isDirectory; | 23 bool isDirectory; |
28 }; | 24 }; |
29 } // namespace file_util_proxy | 25 } // namespace file_util_proxy |
30 | 26 |
31 class MessageLoopProxy; | 27 class MessageLoopProxy; |
| 28 class Time; |
32 | 29 |
33 // This class provides asynchronous access to common file routines. | 30 // This class provides asynchronous access to common file routines. |
34 class FileUtilProxy { | 31 class FileUtilProxy { |
35 public: | 32 public: |
36 // This callback is used by methods that report only an error code. It is | 33 // This callback is used by methods that report only an error code. It is |
37 // valid to pass NULL as the callback parameter to any function that takes a | 34 // valid to pass NULL as the callback parameter to any function that takes a |
38 // StatusCallback, in which case the operation will complete silently. | 35 // StatusCallback, in which case the operation will complete silently. |
39 typedef Callback1<base::PlatformFileError /* error code */ | 36 typedef Callback1<base::PlatformFileError /* error code */ |
40 >::Type StatusCallback; | 37 >::Type StatusCallback; |
41 | 38 |
(...skipping 17 matching lines...) Expand all Loading... |
59 CreateTemporaryCallback* callback); | 56 CreateTemporaryCallback* callback); |
60 | 57 |
61 // Close the given file handle. | 58 // Close the given file handle. |
62 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 59 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
63 base::PlatformFile, | 60 base::PlatformFile, |
64 StatusCallback* callback); | 61 StatusCallback* callback); |
65 | 62 |
66 // Retrieves the information about a file. It is invalid to pass NULL for the | 63 // Retrieves the information about a file. It is invalid to pass NULL for the |
67 // callback. | 64 // callback. |
68 typedef Callback2<base::PlatformFileError /* error code */, | 65 typedef Callback2<base::PlatformFileError /* error code */, |
69 const file_util::FileInfo& /*file_info*/ | 66 const base::PlatformFileInfo& /* file_info */ |
70 >::Type GetFileInfoCallback; | 67 >::Type GetFileInfoCallback; |
71 static bool GetFileInfo( | 68 static bool GetFileInfo( |
72 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 69 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
73 const FilePath& file_path, | 70 const FilePath& file_path, |
74 GetFileInfoCallback* callback); | 71 GetFileInfoCallback* callback); |
75 | 72 |
76 typedef Callback2<base::PlatformFileError /* error code */, | 73 typedef Callback2<base::PlatformFileError /* error code */, |
77 const std::vector<base::file_util_proxy::Entry>& | 74 const std::vector<base::file_util_proxy::Entry>& |
78 >::Type ReadDirectoryCallback; | 75 >::Type ReadDirectoryCallback; |
79 static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 76 static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const FilePath& file_path, | 116 const FilePath& file_path, |
120 StatusCallback* callback); | 117 StatusCallback* callback); |
121 | 118 |
122 private: | 119 private: |
123 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
124 }; | 121 }; |
125 | 122 |
126 } // namespace base | 123 } // namespace base |
127 | 124 |
128 #endif // BASE_FILE_UTIL_PROXY_H_ | 125 #endif // BASE_FILE_UTIL_PROXY_H_ |
OLD | NEW |