summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_context.cc
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 05:15:53 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 05:15:53 +0000
commit397281fdb6003ab5b86ead542a46e3d82aa2be1f (patch)
tree6d7a2d27edfb8b3790dd4a199d2e32283206fcce /webkit/fileapi/file_system_context.cc
parentc10878accf5f6c12c471d77d20b32ef3e84f5693 (diff)
downloadchromium_src-397281fdb6003ab5b86ead542a46e3d82aa2be1f.zip
chromium_src-397281fdb6003ab5b86ead542a46e3d82aa2be1f.tar.gz
chromium_src-397281fdb6003ab5b86ead542a46e3d82aa2be1f.tar.bz2
Cleanup SandboxedFileSystem* and merge them into FileSystem* for simplicity.
Based on our rough discussion over emails, I just went ahead and did the cleanup. BUG=none TEST=none Review URL: http://codereview.chromium.org/6471018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_context.cc')
-rw-r--r--webkit/fileapi/file_system_context.cc66
1 files changed, 66 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
new file mode 100644
index 0000000..c0546d8
--- /dev/null
+++ b/webkit/fileapi/file_system_context.cc
@@ -0,0 +1,66 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/fileapi/file_system_context.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"
+#include "webkit/fileapi/file_system_usage_tracker.h"
+
+namespace fileapi {
+
+FileSystemContext::FileSystemContext(
+ scoped_refptr<base::MessageLoopProxy> file_message_loop,
+ scoped_refptr<base::MessageLoopProxy> io_message_loop,
+ const FilePath& profile_path,
+ bool is_incognito,
+ bool allow_file_access,
+ bool unlimited_quota)
+ : file_message_loop_(file_message_loop),
+ io_message_loop_(io_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)),
+ usage_tracker_(new FileSystemUsageTracker(
+ file_message_loop, profile_path, is_incognito)) {
+}
+
+FileSystemContext::~FileSystemContext() {
+}
+
+void FileSystemContext::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 */);
+}
+
+void FileSystemContext::SetOriginQuotaUnlimited(const GURL& url) {
+ DCHECK(io_message_loop_->BelongsToCurrentThread());
+ quota_manager()->SetOriginQuotaUnlimited(url);
+}
+
+void FileSystemContext::ResetOriginQuotaUnlimited(const GURL& url) {
+ DCHECK(io_message_loop_->BelongsToCurrentThread());
+ quota_manager()->ResetOriginQuotaUnlimited(url);
+}
+
+void FileSystemContext::DeleteOnCorrectThread() const {
+ if (!io_message_loop_->BelongsToCurrentThread()) {
+ io_message_loop_->DeleteSoon(FROM_HERE, this);
+ return;
+ }
+ delete this;
+}
+
+} // namespace fileapi