| 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->CrackFileSystemURL( |
| 433 FileSystemURL(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 base::PlatformFileInfo file_info; | 441 base::PlatformFileInfo file_info; |
| 441 FilePath platform_file_path; | 442 FilePath platform_file_path; |
| 442 usage += enumerator->Size(); | 443 usage += enumerator->Size(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 i < file_system_options_.additional_allowed_schemes().size(); | 571 i < file_system_options_.additional_allowed_schemes().size(); |
| 571 ++i) { | 572 ++i) { |
| 572 if (url.SchemeIs( | 573 if (url.SchemeIs( |
| 573 file_system_options_.additional_allowed_schemes()[i].c_str())) | 574 file_system_options_.additional_allowed_schemes()[i].c_str())) |
| 574 return true; | 575 return true; |
| 575 } | 576 } |
| 576 return false; | 577 return false; |
| 577 } | 578 } |
| 578 | 579 |
| 579 } // namespace fileapi | 580 } // namespace fileapi |
| OLD | NEW |