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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
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(file_path, root_url.path(), recursive, |
146 file_path, root_url.path(), recursive, | 146 file_util::FileEnumerator::FILES | |
147 static_cast<file_util::FileEnumerator::FileType>( | 147 file_util::FileEnumerator::DIRECTORIES); |
148 file_util::FileEnumerator::FILES | | |
149 file_util::FileEnumerator::DIRECTORIES)); | |
150 } | 148 } |
151 | 149 |
152 PlatformFileError LocalFileUtil::GetLocalFilePath( | 150 PlatformFileError LocalFileUtil::GetLocalFilePath( |
153 FileSystemOperationContext* context, | 151 FileSystemOperationContext* context, |
154 const FileSystemURL& url, | 152 const FileSystemURL& url, |
155 FilePath* local_file_path) { | 153 FilePath* local_file_path) { |
156 | 154 |
157 FileSystemMountPointProvider* provider = | 155 FileSystemMountPointProvider* provider = |
158 context->file_system_context()->GetMountPointProvider(url.type()); | 156 context->file_system_context()->GetMountPointProvider(url.type()); |
159 DCHECK(provider); | 157 DCHECK(provider); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 base::PlatformFileInfo* file_info, | 273 base::PlatformFileInfo* file_info, |
276 FilePath* platform_path, | 274 FilePath* platform_path, |
277 SnapshotFilePolicy* policy) { | 275 SnapshotFilePolicy* policy) { |
278 DCHECK(policy); | 276 DCHECK(policy); |
279 // We're just returning the local file information. | 277 // We're just returning the local file information. |
280 *policy = kSnapshotFileLocal; | 278 *policy = kSnapshotFileLocal; |
281 return GetFileInfo(context, url, file_info, platform_path); | 279 return GetFileInfo(context, url, file_info, platform_path); |
282 } | 280 } |
283 | 281 |
284 } // namespace fileapi | 282 } // namespace fileapi |
OLD | NEW |