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_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_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 #include "webkit/quota/special_storage_policy.h" | 10 #include "webkit/quota/special_storage_policy.h" |
11 | 11 |
12 class FilePath; | 12 class FilePath; |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class MessageLoopProxy; | 16 class MessageLoopProxy; |
17 } | 17 } |
18 | 18 |
19 namespace quota { | 19 namespace quota { |
20 class SpecialStoragePolicy; | 20 class SpecialStoragePolicy; |
21 } | 21 } |
22 | 22 |
23 namespace fileapi { | 23 namespace fileapi { |
24 | 24 |
25 class FileSystemContext; | 25 class FileSystemContext; |
26 class FileSystemPathManager; | 26 class FileSystemPathManager; |
27 class FileSystemUsageTracker; | 27 class FileSystemUsageTracker; |
| 28 class SandboxMountPointProvider; |
28 | 29 |
29 struct DefaultContextDeleter; | 30 struct DefaultContextDeleter; |
30 | 31 |
31 // This class keeps and provides a file system context for FileSystem API. | 32 // This class keeps and provides a file system context for FileSystem API. |
32 class FileSystemContext | 33 class FileSystemContext |
33 : public base::RefCountedThreadSafe<FileSystemContext, | 34 : public base::RefCountedThreadSafe<FileSystemContext, |
34 DefaultContextDeleter> { | 35 DefaultContextDeleter> { |
35 public: | 36 public: |
36 FileSystemContext( | 37 FileSystemContext( |
37 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 38 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
38 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 39 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
39 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 40 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
40 const FilePath& profile_path, | 41 const FilePath& profile_path, |
41 bool is_incognito, | 42 bool is_incognito, |
42 bool allow_file_access_from_files, | 43 bool allow_file_access_from_files, |
43 bool unlimited_quota); | 44 bool unlimited_quota); |
44 ~FileSystemContext(); | 45 ~FileSystemContext(); |
45 | 46 |
46 // This method can be called on any thread. | 47 // This method can be called on any thread. |
47 bool IsStorageUnlimited(const GURL& origin); | 48 bool IsStorageUnlimited(const GURL& origin); |
48 | 49 |
49 void DeleteDataForOriginOnFileThread(const GURL& origin_url); | 50 void DeleteDataForOriginOnFileThread(const GURL& origin_url); |
50 | 51 |
51 FileSystemPathManager* path_manager() { return path_manager_.get(); } | 52 FileSystemPathManager* path_manager() { return path_manager_.get(); } |
52 FileSystemUsageTracker* usage_tracker() { return usage_tracker_.get(); } | 53 FileSystemUsageTracker* usage_tracker() { return usage_tracker_.get(); } |
53 | 54 |
54 private: | 55 private: |
55 friend struct DefaultContextDeleter; | 56 friend struct DefaultContextDeleter; |
56 void DeleteOnCorrectThread() const; | 57 void DeleteOnCorrectThread() const; |
| 58 SandboxMountPointProvider* sandbox_provider() const; |
57 | 59 |
58 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 60 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
59 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 61 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
60 | 62 |
61 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 63 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
62 const bool allow_file_access_from_files_; | 64 const bool allow_file_access_from_files_; |
63 const bool unlimited_quota_; | 65 const bool unlimited_quota_; |
64 | 66 |
65 scoped_ptr<FileSystemPathManager> path_manager_; | 67 scoped_ptr<FileSystemPathManager> path_manager_; |
66 scoped_ptr<FileSystemUsageTracker> usage_tracker_; | 68 scoped_ptr<FileSystemUsageTracker> usage_tracker_; |
67 | 69 |
68 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
69 }; | 71 }; |
70 | 72 |
71 struct DefaultContextDeleter { | 73 struct DefaultContextDeleter { |
72 static void Destruct(const FileSystemContext* context) { | 74 static void Destruct(const FileSystemContext* context) { |
73 context->DeleteOnCorrectThread(); | 75 context->DeleteOnCorrectThread(); |
74 } | 76 } |
75 }; | 77 }; |
76 | 78 |
77 } // namespace fileapi | 79 } // namespace fileapi |
78 | 80 |
79 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 81 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |