Chromium Code Reviews| Index: chrome/browser/browsing_data_remover.cc |
| diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc |
| index 74e294c9e66b0cecc6a62bfc5317582ad1432dd8..92bedebe82833978a6b04f5741f558e64c91f8ca 100644 |
| --- a/chrome/browser/browsing_data_remover.cc |
| +++ b/chrome/browser/browsing_data_remover.cc |
| @@ -7,6 +7,8 @@ |
| #include <map> |
| #include <set> |
| +#include "base/logging.h" |
| + |
| #include "base/callback.h" |
| #include "base/file_util.h" |
| #include "base/platform_file.h" |
| @@ -560,23 +562,48 @@ void BrowsingDataRemover::ClearFileSystemsOnFILEThread() { |
| DCHECK(waiting_for_clear_file_systems_); |
| scoped_refptr<fileapi::FileSystemContext> |
| fs_context(profile_->GetFileSystemContext()); |
| + |
| + // As long as the FileSystemContext is refcounted, we can use a raw pointer |
| + // here, and let the FileSystemContext delete the FileSystemFileUtil when |
| + // it's destroyed. |
| + fileapi::FileSystemFileUtil* file_util = fs_context->path_manager()-> |
| + sandbox_provider()->GetFileSystemFileUtil(); |
| + |
| + scoped_ptr<fileapi::FileSystemOperationContext> |
| + op_context(new fileapi::FileSystemOperationContext( |
| + fs_context.get(), file_util)); |
| + |
| + // We own the reference to the OriginEnumerator, so we wrap it in a scoped_ptr |
| + // to ensure that it's destroyed when we leave the FILE thread. |
| scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator> |
| - origin_enumerator(fs_context->path_manager()->sandbox_provider()-> |
| + origins(fs_context->path_manager()->sandbox_provider()-> |
| CreateOriginEnumerator()); |
| GURL origin; |
| - while (!(origin = origin_enumerator->Next()).is_empty()) { |
| + while (!(origin = origins->Next()).is_empty()) { |
| if (special_storage_policy_->IsStorageProtected(origin)) |
| continue; |
| if (delete_begin_ == base::Time()) { |
| // If the user chooses to delete browsing data "since the beginning of |
| // time" remove both temporary and persistent file systems entirely. |
| - fs_context->DeleteDataForOriginAndTypeOnFileThread(origin, |
| - fileapi::kFileSystemTypeTemporary); |
| - fs_context->DeleteDataForOriginAndTypeOnFileThread(origin, |
| - fileapi::kFileSystemTypePersistent); |
| + fs_context->DeleteDataForOriginOnFileThread(origin); |
| + } else { |
| + // Else, walk through the origin's temporary filesystem. If any file has |
| + // been modified in the timeframe, remove the entire filesystem. |
| + if (origins->HasFileSystemType(fileapi::kFileSystemTypeTemporary)) { |
| + op_context->set_src_origin_url(origin); |
| + op_context->set_src_type(fileapi::kFileSystemTypeTemporary); |
| + scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> files( |
| + file_util->CreateFileEnumerator(op_context.get(), fs_context-> |
| + path_manager()->sandbox_provider()-> |
| + ValidateFileSystemRootAndGetPathOnFileThread(origin, |
| + fileapi::kFileSystemTypeTemporary, FilePath(), false))); |
|
ericu
2011/06/08 18:40:24
This isn't the right path to pass to CreateFileEnu
Use mkwst_at_chromium.org plz.
2011/06/08 19:00:09
Gah. Yeah, that makes sense. I'll try it out tom
|
| + FilePath current; |
| + while (!(current = files->Next()).empty()) { |
| + LOG(INFO) << "Path: " << current.MaybeAsASCII(); |
| + } |
| + } |
| } |
| - // TODO(mkwst): Else? Decide what to do for time-based deletion: crbug/63700 |
| } |
| BrowserThread::PostTask( |