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 "webkit/fileapi/local_file_system_file_util.h" | 5 #include "webkit/fileapi/local_file_system_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_operation_context.h" | 10 #include "webkit/fileapi/file_system_operation_context.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return underlying_file_util_->IsDirectoryEmpty( | 226 return underlying_file_util_->IsDirectoryEmpty( |
227 context, local_path); | 227 context, local_path); |
228 } | 228 } |
229 | 229 |
230 class LocalFileSystemFileEnumerator | 230 class LocalFileSystemFileEnumerator |
231 : public FileSystemFileUtil::AbstractFileEnumerator { | 231 : public FileSystemFileUtil::AbstractFileEnumerator { |
232 public: | 232 public: |
233 LocalFileSystemFileEnumerator(const FilePath& platform_root_path, | 233 LocalFileSystemFileEnumerator(const FilePath& platform_root_path, |
234 const FilePath& virtual_root_path, | 234 const FilePath& virtual_root_path, |
235 bool recursive, | 235 bool recursive, |
236 file_util::FileEnumerator::FILE_TYPE file_type) | 236 file_util::FileEnumerator::FileType file_type) |
237 : file_enum_(platform_root_path, recursive, file_type), | 237 : file_enum_(platform_root_path, recursive, file_type), |
238 platform_root_path_(platform_root_path), | 238 platform_root_path_(platform_root_path), |
239 virtual_root_path_(virtual_root_path) { | 239 virtual_root_path_(virtual_root_path) { |
240 } | 240 } |
241 | 241 |
242 ~LocalFileSystemFileEnumerator() {} | 242 ~LocalFileSystemFileEnumerator() {} |
243 | 243 |
244 virtual FilePath Next(); | 244 virtual FilePath Next(); |
245 virtual bool IsDirectory(); | 245 virtual bool IsDirectory(); |
246 | 246 |
(...skipping 23 matching lines...) Expand all Loading... |
270 LocalFileSystemFileUtil::CreateFileEnumerator( | 270 LocalFileSystemFileUtil::CreateFileEnumerator( |
271 FileSystemOperationContext* context, | 271 FileSystemOperationContext* context, |
272 const FilePath& root_path) { | 272 const FilePath& root_path) { |
273 FilePath local_path = | 273 FilePath local_path = |
274 GetLocalPath(context, context->src_origin_url(), context->src_type(), | 274 GetLocalPath(context, context->src_origin_url(), context->src_type(), |
275 root_path); | 275 root_path); |
276 if (local_path.empty()) | 276 if (local_path.empty()) |
277 return new EmptyFileEnumerator(); | 277 return new EmptyFileEnumerator(); |
278 return new LocalFileSystemFileEnumerator( | 278 return new LocalFileSystemFileEnumerator( |
279 local_path, root_path, true, | 279 local_path, root_path, true, |
280 static_cast<file_util::FileEnumerator::FILE_TYPE>( | 280 static_cast<file_util::FileEnumerator::FileType>( |
281 file_util::FileEnumerator::FILES | | 281 file_util::FileEnumerator::FILES | |
282 file_util::FileEnumerator::DIRECTORIES)); | 282 file_util::FileEnumerator::DIRECTORIES)); |
283 } | 283 } |
284 | 284 |
285 FilePath LocalFileSystemFileUtil::GetLocalPath( | 285 FilePath LocalFileSystemFileUtil::GetLocalPath( |
286 FileSystemOperationContext* context, | 286 FileSystemOperationContext* context, |
287 const GURL& origin_url, | 287 const GURL& origin_url, |
288 FileSystemType type, | 288 FileSystemType type, |
289 const FilePath& virtual_path) { | 289 const FilePath& virtual_path) { |
290 FilePath root = context->file_system_context()->path_manager()-> | 290 FilePath root = context->file_system_context()->path_manager()-> |
291 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, | 291 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, |
292 virtual_path, false); | 292 virtual_path, false); |
293 if (root.empty()) | 293 if (root.empty()) |
294 return FilePath(); | 294 return FilePath(); |
295 return root.Append(virtual_path); | 295 return root.Append(virtual_path); |
296 } | 296 } |
297 | 297 |
298 } // namespace fileapi | 298 } // namespace fileapi |
OLD | NEW |