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 #include "base/platform_file.h" | 5 #include "base/platform_file.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 DWORD access = (flags & PLATFORM_FILE_READ) ? GENERIC_READ : 0; | 52 DWORD access = (flags & PLATFORM_FILE_READ) ? GENERIC_READ : 0; |
53 if (flags & PLATFORM_FILE_WRITE) | 53 if (flags & PLATFORM_FILE_WRITE) |
54 access |= GENERIC_WRITE; | 54 access |= GENERIC_WRITE; |
55 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES) | 55 if (flags & PLATFORM_FILE_WRITE_ATTRIBUTES) |
56 access |= FILE_WRITE_ATTRIBUTES; | 56 access |= FILE_WRITE_ATTRIBUTES; |
57 | 57 |
58 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; | 58 DWORD sharing = (flags & PLATFORM_FILE_EXCLUSIVE_READ) ? 0 : FILE_SHARE_READ; |
59 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE)) | 59 if (!(flags & PLATFORM_FILE_EXCLUSIVE_WRITE)) |
60 sharing |= FILE_SHARE_WRITE; | 60 sharing |= FILE_SHARE_WRITE; |
| 61 if (flags & PLATFORM_FILE_SHARE_DELETE) |
| 62 sharing |= FILE_SHARE_DELETE; |
61 | 63 |
62 DWORD create_flags = 0; | 64 DWORD create_flags = 0; |
63 if (flags & PLATFORM_FILE_ASYNC) | 65 if (flags & PLATFORM_FILE_ASYNC) |
64 create_flags |= FILE_FLAG_OVERLAPPED; | 66 create_flags |= FILE_FLAG_OVERLAPPED; |
65 if (flags & PLATFORM_FILE_TEMPORARY) | 67 if (flags & PLATFORM_FILE_TEMPORARY) |
66 create_flags |= FILE_ATTRIBUTE_TEMPORARY; | 68 create_flags |= FILE_ATTRIBUTE_TEMPORARY; |
67 if (flags & PLATFORM_FILE_HIDDEN) | 69 if (flags & PLATFORM_FILE_HIDDEN) |
68 create_flags |= FILE_ATTRIBUTE_HIDDEN; | 70 create_flags |= FILE_ATTRIBUTE_HIDDEN; |
69 if (flags & PLATFORM_FILE_DELETE_ON_CLOSE) | 71 if (flags & PLATFORM_FILE_DELETE_ON_CLOSE) |
70 create_flags |= FILE_FLAG_DELETE_ON_CLOSE; | 72 create_flags |= FILE_FLAG_DELETE_ON_CLOSE; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 info->is_directory = | 213 info->is_directory = |
212 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; | 214 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; |
213 info->is_symbolic_link = false; // Windows doesn't have symbolic links. | 215 info->is_symbolic_link = false; // Windows doesn't have symbolic links. |
214 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); | 216 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); |
215 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); | 217 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); |
216 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); | 218 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); |
217 return true; | 219 return true; |
218 } | 220 } |
219 | 221 |
220 } // namespace disk_cache | 222 } // namespace disk_cache |
OLD | NEW |