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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 const FilePath& virtual_root_path, | 234 const FilePath& virtual_root_path, |
235 bool recursive, | 235 bool recursive, |
236 file_util::FileEnumerator::FileType 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() OVERRIDE; |
245 virtual bool IsDirectory(); | 245 virtual int64 Size() OVERRIDE; |
| 246 virtual bool IsDirectory() OVERRIDE; |
246 | 247 |
247 private: | 248 private: |
248 file_util::FileEnumerator file_enum_; | 249 file_util::FileEnumerator file_enum_; |
| 250 file_util::FileEnumerator::FindInfo file_util_info_; |
249 FilePath platform_root_path_; | 251 FilePath platform_root_path_; |
250 FilePath virtual_root_path_; | 252 FilePath virtual_root_path_; |
251 }; | 253 }; |
252 | 254 |
253 FilePath LocalFileSystemFileEnumerator::Next() { | 255 FilePath LocalFileSystemFileEnumerator::Next() { |
254 FilePath next = file_enum_.Next(); | 256 FilePath next = file_enum_.Next(); |
255 if (next.empty()) | 257 if (next.empty()) |
256 return next; | 258 return next; |
| 259 file_enum_.GetFindInfo(&file_util_info_); |
257 | 260 |
258 FilePath path; | 261 FilePath path; |
259 platform_root_path_.AppendRelativePath(next, &path); | 262 platform_root_path_.AppendRelativePath(next, &path); |
260 return virtual_root_path_.Append(path); | 263 return virtual_root_path_.Append(path); |
261 } | 264 } |
262 | 265 |
| 266 int64 LocalFileSystemFileEnumerator::Size() { |
| 267 return file_util::FileEnumerator::GetFilesize(file_util_info_); |
| 268 } |
| 269 |
263 bool LocalFileSystemFileEnumerator::IsDirectory() { | 270 bool LocalFileSystemFileEnumerator::IsDirectory() { |
264 file_util::FileEnumerator::FindInfo file_util_info; | 271 return file_util::FileEnumerator::IsDirectory(file_util_info_); |
265 file_enum_.GetFindInfo(&file_util_info); | |
266 return file_util::FileEnumerator::IsDirectory(file_util_info); | |
267 } | 272 } |
268 | 273 |
269 FileSystemFileUtil::AbstractFileEnumerator* | 274 FileSystemFileUtil::AbstractFileEnumerator* |
270 LocalFileSystemFileUtil::CreateFileEnumerator( | 275 LocalFileSystemFileUtil::CreateFileEnumerator( |
271 FileSystemOperationContext* context, | 276 FileSystemOperationContext* context, |
272 const FilePath& root_path) { | 277 const FilePath& root_path) { |
273 FilePath local_path = | 278 FilePath local_path = |
274 GetLocalPath(context, context->src_origin_url(), context->src_type(), | 279 GetLocalPath(context, context->src_origin_url(), context->src_type(), |
275 root_path); | 280 root_path); |
276 if (local_path.empty()) | 281 if (local_path.empty()) |
(...skipping 12 matching lines...) Expand all Loading... |
289 const FilePath& virtual_path) { | 294 const FilePath& virtual_path) { |
290 FilePath root = context->file_system_context()->path_manager()-> | 295 FilePath root = context->file_system_context()->path_manager()-> |
291 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, | 296 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, |
292 virtual_path, false); | 297 virtual_path, false); |
293 if (root.empty()) | 298 if (root.empty()) |
294 return FilePath(); | 299 return FilePath(); |
295 return root.Append(virtual_path); | 300 return root.Append(virtual_path); |
296 } | 301 } |
297 | 302 |
298 } // namespace fileapi | 303 } // namespace fileapi |
OLD | NEW |