diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 03:21:37 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 03:21:37 +0000 |
commit | 09a31602ef7b10148b28b894bdbf7cc359443084 (patch) | |
tree | 9eb740e700a27db1a2ea947cb94e1f989e10ebd0 /webkit | |
parent | 815cce6882ce16b8fd022acfe8d764599dd060fa (diff) | |
download | chromium_src-09a31602ef7b10148b28b894bdbf7cc359443084.zip chromium_src-09a31602ef7b10148b28b894bdbf7cc359443084.tar.gz chromium_src-09a31602ef7b10148b28b894bdbf7cc359443084.tar.bz2 |
Delete FileSystem API data when uninstalling extensions.
BUG=63700
TEST=load an extension that keeps writing to file system and unload it. See if the origin data under the profile is deleted.
Review URL: http://codereview.chromium.org/5272010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/file_system_path_manager.h | 6 | ||||
-rw-r--r-- | webkit/fileapi/sandboxed_file_system_context.cc | 22 | ||||
-rw-r--r-- | webkit/fileapi/sandboxed_file_system_context.h | 10 |
3 files changed, 31 insertions, 7 deletions
diff --git a/webkit/fileapi/file_system_path_manager.h b/webkit/fileapi/file_system_path_manager.h index 12104ef..16c7182 100644 --- a/webkit/fileapi/file_system_path_manager.h +++ b/webkit/fileapi/file_system_path_manager.h @@ -74,12 +74,12 @@ class FileSystemPathManager { return base_path_; } - private: - class GetFileSystemRootPathTask; - // Returns the storage identifier string for the given |url|. static std::string GetStorageIdentifierFromURL(const GURL& url); + private: + class GetFileSystemRootPathTask; + scoped_refptr<base::MessageLoopProxy> file_message_loop_; const FilePath base_path_; diff --git a/webkit/fileapi/sandboxed_file_system_context.cc b/webkit/fileapi/sandboxed_file_system_context.cc index b71f57c..b3b009e 100644 --- a/webkit/fileapi/sandboxed_file_system_context.cc +++ b/webkit/fileapi/sandboxed_file_system_context.cc @@ -4,7 +4,7 @@ #include "webkit/fileapi/sandboxed_file_system_context.h" -#include "base/file_path.h" +#include "base/file_util.h" #include "base/message_loop_proxy.h" #include "webkit/fileapi/file_system_path_manager.h" #include "webkit/fileapi/file_system_quota_manager.h" @@ -17,10 +17,11 @@ SandboxedFileSystemContext::SandboxedFileSystemContext( bool is_incognito, bool allow_file_access, bool unlimited_quota) - : path_manager_(new FileSystemPathManager( + : file_message_loop_(file_message_loop), + path_manager_(new FileSystemPathManager( file_message_loop, profile_path, is_incognito, allow_file_access)), - quota_manager_(new FileSystemQuotaManager(allow_file_access, - unlimited_quota)) { + quota_manager_(new FileSystemQuotaManager( + allow_file_access, unlimited_quota)) { } SandboxedFileSystemContext::~SandboxedFileSystemContext() { @@ -31,4 +32,17 @@ void SandboxedFileSystemContext::Shutdown() { quota_manager_.reset(); } +void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread( + const GURL& origin_url) { + DCHECK(path_manager_.get()); + DCHECK(file_message_loop_->BelongsToCurrentThread()); + + std::string storage_identifier = + FileSystemPathManager::GetStorageIdentifierFromURL(origin_url); + FilePath path_for_origin = path_manager_->base_path().AppendASCII( + storage_identifier); + + file_util::Delete(path_for_origin, true /* recursive */); +} + } // namespace fileapi diff --git a/webkit/fileapi/sandboxed_file_system_context.h b/webkit/fileapi/sandboxed_file_system_context.h index ad6e2b8..6c72bc0 100644 --- a/webkit/fileapi/sandboxed_file_system_context.h +++ b/webkit/fileapi/sandboxed_file_system_context.h @@ -9,6 +9,7 @@ #include "base/scoped_ptr.h" class FilePath; +class GURL; namespace base { class MessageLoopProxy; @@ -18,6 +19,9 @@ namespace fileapi { class FileSystemPathManager; class FileSystemQuotaManager; +class SandboxedFileSystemContext; + +struct DefaultContextDeleter; // This class keeps and provides a sandboxed file system context. class SandboxedFileSystemContext { @@ -32,11 +36,17 @@ class SandboxedFileSystemContext { void Shutdown(); + void DeleteDataForOriginOnFileThread(const GURL& origin_url); + FileSystemPathManager* path_manager() { return path_manager_.get(); } FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } private: + friend struct DefaultContextDeleter; + void DeleteOnCorrectThread() const; + bool allow_file_access_from_files_; + scoped_refptr<base::MessageLoopProxy> file_message_loop_; scoped_ptr<FileSystemPathManager> path_manager_; scoped_ptr<FileSystemQuotaManager> quota_manager_; |