summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_data_deleter.cc12
-rw-r--r--chrome/browser/extensions/extension_data_deleter.h7
-rw-r--r--webkit/fileapi/file_system_path_manager.h6
-rw-r--r--webkit/fileapi/sandboxed_file_system_context.cc22
-rw-r--r--webkit/fileapi/sandboxed_file_system_context.h10
5 files changed, 50 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_data_deleter.cc b/chrome/browser/extensions/extension_data_deleter.cc
index a1d2052..d87ffef 100644
--- a/chrome/browser/extensions/extension_data_deleter.cc
+++ b/chrome/browser/extensions/extension_data_deleter.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/file_system/browser_file_system_context.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "net/base/cookie_monster.h"
@@ -19,6 +20,7 @@ ExtensionDataDeleter::ExtensionDataDeleter(Profile* profile,
webkit_context_ = profile->GetWebKitContext();
database_tracker_ = profile->GetDatabaseTracker();
extension_request_context_ = profile->GetRequestContextForExtensions();
+ file_system_context_ = profile->GetFileSystemContext();
extension_url_ = extension_url;
origin_id_ =
webkit_database::DatabaseUtil::GetOriginIdentifier(extension_url_);
@@ -48,6 +50,11 @@ void ExtensionDataDeleter::StartDeleting() {
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(
this, &ExtensionDataDeleter::DeleteDatabaseOnFileThread));
+
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableMethod(
+ this, &ExtensionDataDeleter::DeleteFileSystemOnFileThread));
}
void ExtensionDataDeleter::DeleteCookiesOnIOThread() {
@@ -74,3 +81,8 @@ void ExtensionDataDeleter::DeleteIndexedDBOnWebkitThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
webkit_context_->indexed_db_context()->DeleteIndexedDBForOrigin(origin_id_);
}
+
+void ExtensionDataDeleter::DeleteFileSystemOnFileThread() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ file_system_context_->DeleteDataForOriginOnFileThread(extension_url_);
+}
diff --git a/chrome/browser/extensions/extension_data_deleter.h b/chrome/browser/extensions/extension_data_deleter.h
index 0a535fe..86d5aa5 100644
--- a/chrome/browser/extensions/extension_data_deleter.h
+++ b/chrome/browser/extensions/extension_data_deleter.h
@@ -15,6 +15,7 @@ namespace webkit_database {
class DatabaseTracker;
}
+class BrowserFileSystemContext;
class Profile;
class URLRequestContextGetter;
class WebKitContext;
@@ -52,6 +53,10 @@ class ExtensionDataDeleter
// webkit thread.
void DeleteIndexedDBOnWebkitThread();
+ // Deletes filesystem files for the extension. May only be called on the
+ // file thread.
+ void DeleteFileSystemOnFileThread();
+
// The database context for deleting the database.
scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
@@ -67,6 +72,8 @@ class ExtensionDataDeleter
// Webkit context for accessing the DOM storage helper.
scoped_refptr<WebKitContext> webkit_context_;
+ scoped_refptr<BrowserFileSystemContext> file_system_context_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionDataDeleter);
};
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_;