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/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 if (is_valid && (dirty_status == 0 || (dirty_status > 0 && visited))) { | 422 if (is_valid && (dirty_status == 0 || (dirty_status > 0 && visited))) { |
423 // The usage cache is clean (dirty == 0) or the origin is already | 423 // The usage cache is clean (dirty == 0) or the origin is already |
424 // initialized and running. Read the cache file to get the usage. | 424 // initialized and running. Read the cache file to get the usage. |
425 return FileSystemUsageCache::GetUsage(usage_file_path); | 425 return FileSystemUsageCache::GetUsage(usage_file_path); |
426 } | 426 } |
427 // The usage cache has not been initialized or the cache is dirty. | 427 // The usage cache has not been initialized or the cache is dirty. |
428 // Get the directory size now and update the cache. | 428 // Get the directory size now and update the cache. |
429 FileSystemUsageCache::Delete(usage_file_path); | 429 FileSystemUsageCache::Delete(usage_file_path); |
430 | 430 |
431 FileSystemOperationContext context(file_system_context); | 431 FileSystemOperationContext context(file_system_context); |
432 FileSystemURL url(origin_url, type, FilePath()); | 432 FileSystemURL url = file_system_context->CreateCrackedFileSystemURL( |
| 433 origin_url, type, FilePath()); |
433 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( | 434 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( |
434 sandbox_file_util_->CreateFileEnumerator(&context, url, true)); | 435 sandbox_file_util_->CreateFileEnumerator(&context, url, true)); |
435 | 436 |
436 FilePath file_path_each; | 437 FilePath file_path_each; |
437 int64 usage = 0; | 438 int64 usage = 0; |
438 | 439 |
439 while (!(file_path_each = enumerator->Next()).empty()) { | 440 while (!(file_path_each = enumerator->Next()).empty()) { |
440 usage += enumerator->Size(); | 441 usage += enumerator->Size(); |
441 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); | 442 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); |
442 } | 443 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 i < file_system_options_.additional_allowed_schemes().size(); | 569 i < file_system_options_.additional_allowed_schemes().size(); |
569 ++i) { | 570 ++i) { |
570 if (url.SchemeIs( | 571 if (url.SchemeIs( |
571 file_system_options_.additional_allowed_schemes()[i].c_str())) | 572 file_system_options_.additional_allowed_schemes()[i].c_str())) |
572 return true; | 573 return true; |
573 } | 574 } |
574 return false; | 575 return false; |
575 } | 576 } |
576 | 577 |
577 } // namespace fileapi | 578 } // namespace fileapi |
OLD | NEW |