OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "webkit/fileapi/file_system_types.h" | 10 #include "webkit/fileapi/file_system_types.h" |
11 #include "webkit/quota/special_storage_policy.h" | 11 #include "webkit/quota/special_storage_policy.h" |
12 | 12 |
13 class FilePath; | 13 class FilePath; |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class MessageLoopProxy; | 17 class MessageLoopProxy; |
18 } | 18 } |
19 | 19 |
20 namespace quota { | 20 namespace quota { |
21 class QuotaManagerProxy; | 21 class QuotaManagerProxy; |
22 } | 22 } |
23 | 23 |
24 namespace fileapi { | 24 namespace fileapi { |
25 | 25 |
26 class ExternalFileSystemMountPointProvider; | 26 class ExternalFileSystemMountPointProvider; |
| 27 class FileSystemCallbackDispatcher; |
27 class FileSystemContext; | 28 class FileSystemContext; |
28 class FileSystemFileUtil; | 29 class FileSystemFileUtil; |
29 class FileSystemMountPointProvider; | 30 class FileSystemMountPointProvider; |
30 class FileSystemOptions; | 31 class FileSystemOptions; |
31 class FileSystemPathManager; | 32 class FileSystemPathManager; |
32 class FileSystemQuotaUtil; | 33 class FileSystemQuotaUtil; |
33 class SandboxMountPointProvider; | 34 class SandboxMountPointProvider; |
34 | 35 |
35 struct DefaultContextDeleter; | 36 struct DefaultContextDeleter; |
36 | 37 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem | 78 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem |
78 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling | 79 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling |
79 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}). | 80 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}). |
80 SandboxMountPointProvider* sandbox_provider() const; | 81 SandboxMountPointProvider* sandbox_provider() const; |
81 | 82 |
82 // Returns a FileSystemMountPointProvider instance for external filesystem | 83 // Returns a FileSystemMountPointProvider instance for external filesystem |
83 // type, which is used only by chromeos for now. This is equivalent to | 84 // type, which is used only by chromeos for now. This is equivalent to |
84 // calling GetMountPointProvider(kFileSystemTypeExternal). | 85 // calling GetMountPointProvider(kFileSystemTypeExternal). |
85 ExternalFileSystemMountPointProvider* external_provider() const; | 86 ExternalFileSystemMountPointProvider* external_provider() const; |
86 | 87 |
| 88 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
| 89 // the DidOpenFileSystem callback of the given |dispatcher|. |
| 90 // If |create| is true this may actually set up a filesystem instance |
| 91 // (e.g. by creating the root directory or initializing the database |
| 92 // entry etc). |
| 93 // TODO(kinuko): replace the dispatcher with a regular callback. |
| 94 void OpenFileSystem( |
| 95 const GURL& origin_url, |
| 96 FileSystemType type, |
| 97 bool create, |
| 98 scoped_ptr<FileSystemCallbackDispatcher> dispatcher); |
| 99 |
87 private: | 100 private: |
88 friend struct DefaultContextDeleter; | 101 friend struct DefaultContextDeleter; |
89 void DeleteOnCorrectThread() const; | 102 void DeleteOnCorrectThread() const; |
90 | 103 |
91 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 104 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
92 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 105 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
93 | 106 |
94 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 107 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
95 | 108 |
96 // Mount point providers. | 109 // Mount point providers. |
97 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 110 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
98 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 111 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
99 | 112 |
100 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
101 }; | 114 }; |
102 | 115 |
103 struct DefaultContextDeleter { | 116 struct DefaultContextDeleter { |
104 static void Destruct(const FileSystemContext* context) { | 117 static void Destruct(const FileSystemContext* context) { |
105 context->DeleteOnCorrectThread(); | 118 context->DeleteOnCorrectThread(); |
106 } | 119 } |
107 }; | 120 }; |
108 | 121 |
109 } // namespace fileapi | 122 } // namespace fileapi |
110 | 123 |
111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 124 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |