summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_context.h
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.h
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.h')
-rw-r--r--webkit/fileapi/file_system_context.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h
new file mode 100644
index 0000000..5c94c5f
--- /dev/null
+++ b/webkit/fileapi/file_system_context.h
@@ -0,0 +1,72 @@
+// 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.
+
+#ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
+#define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
+
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+
+class FilePath;
+class GURL;
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace fileapi {
+
+class FileSystemPathManager;
+class FileSystemQuotaManager;
+class FileSystemUsageTracker;
+class FileSystemContext;
+
+struct DefaultContextDeleter;
+
+// This class keeps and provides a file system context for FileSystem API.
+class FileSystemContext
+ : public base::RefCountedThreadSafe<FileSystemContext,
+ DefaultContextDeleter> {
+ public:
+ 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_from_files,
+ bool unlimited_quota);
+ ~FileSystemContext();
+
+ void DeleteDataForOriginOnFileThread(const GURL& origin_url);
+
+ // Quota related methods.
+ void SetOriginQuotaUnlimited(const GURL& url);
+ void ResetOriginQuotaUnlimited(const GURL& url);
+
+ FileSystemPathManager* path_manager() { return path_manager_.get(); }
+ FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); }
+ FileSystemUsageTracker* usage_tracker() { return usage_tracker_.get(); }
+
+ private:
+ friend struct DefaultContextDeleter;
+ void DeleteOnCorrectThread() const;
+
+ scoped_refptr<base::MessageLoopProxy> file_message_loop_;
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_;
+ scoped_ptr<FileSystemPathManager> path_manager_;
+ scoped_ptr<FileSystemQuotaManager> quota_manager_;
+ scoped_ptr<FileSystemUsageTracker> usage_tracker_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext);
+};
+
+struct DefaultContextDeleter {
+ static void Destruct(const FileSystemContext* context) {
+ context->DeleteOnCorrectThread();
+ }
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_