OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FILES_FILE_H_ | 5 #ifndef BASE_FILES_FILE_H_ |
6 #define BASE_FILES_FILE_H_ | 6 #define BASE_FILES_FILE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // The last modified time of a file. | 148 // The last modified time of a file. |
149 base::Time last_modified; | 149 base::Time last_modified; |
150 | 150 |
151 // The last accessed time of a file. | 151 // The last accessed time of a file. |
152 base::Time last_accessed; | 152 base::Time last_accessed; |
153 | 153 |
154 // The creation time of a file. | 154 // The creation time of a file. |
155 base::Time creation_time; | 155 base::Time creation_time; |
156 }; | 156 }; |
157 | 157 |
| 158 // Used to hold information about a region [offset + size] of a file. |
| 159 struct BASE_EXPORT Region { |
| 160 static const Region kWholeFile; |
| 161 |
| 162 Region(int64 offset, int64 size); |
| 163 |
| 164 bool operator==(const Region& other) const; |
| 165 |
| 166 // Start of the region (measured in bytes from the beginning of the file). |
| 167 int64 offset; |
| 168 |
| 169 // Length of the region in bytes. |
| 170 int64 size; |
| 171 |
| 172 private: |
| 173 // This ctor is used only by kWholeFile, to construct a zero-sized Region |
| 174 // (which is forbidden by the public ctor) and uniquely identify kWholeFile. |
| 175 Region(); |
| 176 }; |
| 177 |
158 File(); | 178 File(); |
159 | 179 |
160 // Creates or opens the given file. This will fail with 'access denied' if the | 180 // Creates or opens the given file. This will fail with 'access denied' if the |
161 // |name| contains path traversal ('..') components. | 181 // |name| contains path traversal ('..') components. |
162 File(const FilePath& name, uint32 flags); | 182 File(const FilePath& name, uint32 flags); |
163 | 183 |
164 // Takes ownership of |platform_file|. | 184 // Takes ownership of |platform_file|. |
165 explicit File(PlatformFile platform_file); | 185 explicit File(PlatformFile platform_file); |
166 | 186 |
167 // Creates an object with a specific error_details code. | 187 // Creates an object with a specific error_details code. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 #endif | 324 #endif |
305 | 325 |
306 Error error_details_; | 326 Error error_details_; |
307 bool created_; | 327 bool created_; |
308 bool async_; | 328 bool async_; |
309 }; | 329 }; |
310 | 330 |
311 } // namespace base | 331 } // namespace base |
312 | 332 |
313 #endif // BASE_FILES_FILE_H_ | 333 #endif // BASE_FILES_FILE_H_ |
OLD | NEW |