OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
7 | 7 |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 | 10 |
11 class FilePath; | 11 class FilePath; |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class MessageLoopProxy; | 15 class MessageLoopProxy; |
16 } | 16 } |
17 | 17 |
18 namespace fileapi { | 18 namespace fileapi { |
19 | 19 |
20 class FileSystemPathManager; | 20 class FileSystemPathManager; |
21 class FileSystemQuotaManager; | 21 class FileSystemQuotaManager; |
| 22 class FileSystemUsageTracker; |
22 class SandboxedFileSystemContext; | 23 class SandboxedFileSystemContext; |
23 | 24 |
24 struct DefaultContextDeleter; | 25 struct DefaultContextDeleter; |
25 | 26 |
26 // This class keeps and provides a sandboxed file system context. | 27 // This class keeps and provides a sandboxed file system context. |
27 class SandboxedFileSystemContext | 28 class SandboxedFileSystemContext |
28 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, | 29 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, |
29 DefaultContextDeleter> { | 30 DefaultContextDeleter> { |
30 public: | 31 public: |
31 SandboxedFileSystemContext( | 32 SandboxedFileSystemContext( |
32 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 33 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
33 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 34 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
34 const FilePath& profile_path, | 35 const FilePath& profile_path, |
35 bool is_incognito, | 36 bool is_incognito, |
36 bool allow_file_access_from_files, | 37 bool allow_file_access_from_files, |
37 bool unlimited_quota); | 38 bool unlimited_quota); |
38 ~SandboxedFileSystemContext(); | 39 ~SandboxedFileSystemContext(); |
39 | 40 |
40 void Shutdown(); | |
41 | |
42 void DeleteDataForOriginOnFileThread(const GURL& origin_url); | 41 void DeleteDataForOriginOnFileThread(const GURL& origin_url); |
43 | 42 |
44 // Quota related methods. | 43 // Quota related methods. |
45 void SetOriginQuotaUnlimited(const GURL& url); | 44 void SetOriginQuotaUnlimited(const GURL& url); |
46 void ResetOriginQuotaUnlimited(const GURL& url); | 45 void ResetOriginQuotaUnlimited(const GURL& url); |
47 | 46 |
48 FileSystemPathManager* path_manager() { return path_manager_.get(); } | 47 FileSystemPathManager* path_manager() { return path_manager_.get(); } |
49 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } | 48 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } |
| 49 FileSystemUsageTracker* usage_tracker() { return usage_tracker_.get(); } |
50 | 50 |
51 private: | 51 private: |
52 friend struct DefaultContextDeleter; | 52 friend struct DefaultContextDeleter; |
53 void DeleteOnCorrectThread() const; | 53 void DeleteOnCorrectThread() const; |
54 | 54 |
55 bool allow_file_access_from_files_; | |
56 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 55 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
57 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 56 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
58 scoped_ptr<FileSystemPathManager> path_manager_; | 57 scoped_ptr<FileSystemPathManager> path_manager_; |
59 scoped_ptr<FileSystemQuotaManager> quota_manager_; | 58 scoped_ptr<FileSystemQuotaManager> quota_manager_; |
| 59 scoped_ptr<FileSystemUsageTracker> usage_tracker_; |
60 | 60 |
61 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); |
62 }; | 62 }; |
63 | 63 |
64 struct DefaultContextDeleter { | 64 struct DefaultContextDeleter { |
65 static void Destruct(const SandboxedFileSystemContext* context) { | 65 static void Destruct(const SandboxedFileSystemContext* context) { |
66 context->DeleteOnCorrectThread(); | 66 context->DeleteOnCorrectThread(); |
67 } | 67 } |
68 }; | 68 }; |
69 | 69 |
70 } // namespace fileapi | 70 } // namespace fileapi |
71 | 71 |
72 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 72 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |