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 #include "webkit/fileapi/local_file_util.h" | 5 #include "webkit/fileapi/local_file_util.h" |
6 | 6 |
7 #include "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "webkit/fileapi/file_system_context.h" | 9 #include "webkit/fileapi/file_system_context.h" |
10 #include "webkit/fileapi/file_system_mount_point_provider.h" | 10 #include "webkit/fileapi/file_system_mount_point_provider.h" |
11 #include "webkit/fileapi/file_system_operation_context.h" | 11 #include "webkit/fileapi/file_system_operation_context.h" |
12 #include "webkit/fileapi/file_system_types.h" | 12 #include "webkit/fileapi/file_system_types.h" |
13 #include "webkit/fileapi/file_system_url.h" | 13 #include "webkit/fileapi/file_system_url.h" |
14 #include "webkit/fileapi/file_system_util.h" | 14 #include "webkit/fileapi/file_system_util.h" |
15 #include "webkit/fileapi/native_file_util.h" | 15 #include "webkit/fileapi/native_file_util.h" |
16 | 16 |
17 namespace fileapi { | 17 namespace fileapi { |
18 | 18 |
19 class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { | 19 class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { |
20 public: | 20 public: |
21 LocalFileEnumerator(const FilePath& platform_root_path, | 21 LocalFileEnumerator(const FilePath& platform_root_path, |
22 const FilePath& virtual_root_path, | 22 const FilePath& virtual_root_path, |
23 bool recursive, | 23 bool recursive, |
24 file_util::FileEnumerator::FileType file_type) | 24 int file_type) |
25 : file_enum_(platform_root_path, recursive, file_type), | 25 : file_enum_(platform_root_path, recursive, file_type), |
26 platform_root_path_(platform_root_path), | 26 platform_root_path_(platform_root_path), |
27 virtual_root_path_(virtual_root_path) { | 27 virtual_root_path_(virtual_root_path) { |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 memset(&file_util_info_, 0, sizeof(file_util_info_)); | 29 memset(&file_util_info_, 0, sizeof(file_util_info_)); |
30 #endif // defined(OS_WIN) | 30 #endif // defined(OS_WIN) |
31 } | 31 } |
32 | 32 |
33 ~LocalFileEnumerator() {} | 33 ~LocalFileEnumerator() {} |
34 | 34 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 136 |
137 FileSystemFileUtil::AbstractFileEnumerator* LocalFileUtil::CreateFileEnumerator( | 137 FileSystemFileUtil::AbstractFileEnumerator* LocalFileUtil::CreateFileEnumerator( |
138 FileSystemOperationContext* context, | 138 FileSystemOperationContext* context, |
139 const FileSystemURL& root_url, | 139 const FileSystemURL& root_url, |
140 bool recursive) { | 140 bool recursive) { |
141 FilePath file_path; | 141 FilePath file_path; |
142 if (GetLocalFilePath(context, root_url, &file_path) != | 142 if (GetLocalFilePath(context, root_url, &file_path) != |
143 base::PLATFORM_FILE_OK) | 143 base::PLATFORM_FILE_OK) |
144 return new EmptyFileEnumerator(); | 144 return new EmptyFileEnumerator(); |
145 return new LocalFileEnumerator( | 145 return new LocalFileEnumerator( |
146 file_path, root_url.path(), recursive, | 146 file_path, root_url.path(), recursive, |
jar (doing other things)
2012/08/06 18:27:02
nit:push 146 onto end of 145.
Haruki Sato
2012/08/06 23:22:18
Done.
| |
147 static_cast<file_util::FileEnumerator::FileType>( | 147 (file_util::FileEnumerator::FILES | |
148 file_util::FileEnumerator::FILES | | 148 file_util::FileEnumerator::DIRECTORIES)); |
149 file_util::FileEnumerator::DIRECTORIES)); | |
150 } | 149 } |
151 | 150 |
152 PlatformFileError LocalFileUtil::GetLocalFilePath( | 151 PlatformFileError LocalFileUtil::GetLocalFilePath( |
153 FileSystemOperationContext* context, | 152 FileSystemOperationContext* context, |
154 const FileSystemURL& url, | 153 const FileSystemURL& url, |
155 FilePath* local_file_path) { | 154 FilePath* local_file_path) { |
156 | 155 |
157 FileSystemMountPointProvider* provider = | 156 FileSystemMountPointProvider* provider = |
158 context->file_system_context()->GetMountPointProvider(url.type()); | 157 context->file_system_context()->GetMountPointProvider(url.type()); |
159 DCHECK(provider); | 158 DCHECK(provider); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 base::PlatformFileInfo* file_info, | 274 base::PlatformFileInfo* file_info, |
276 FilePath* platform_path, | 275 FilePath* platform_path, |
277 SnapshotFilePolicy* policy) { | 276 SnapshotFilePolicy* policy) { |
278 DCHECK(policy); | 277 DCHECK(policy); |
279 // We're just returning the local file information. | 278 // We're just returning the local file information. |
280 *policy = kSnapshotFileLocal; | 279 *policy = kSnapshotFileLocal; |
281 return GetFileInfo(context, url, file_info, platform_path); | 280 return GetFileInfo(context, url, file_info, platform_path); |
282 } | 281 } |
283 | 282 |
284 } // namespace fileapi | 283 } // namespace fileapi |
OLD | NEW |