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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // blocking file operations (like SequencedWorkerPool implementation does). | 59 // blocking file operations (like SequencedWorkerPool implementation does). |
60 FileSystemContext( | 60 FileSystemContext( |
61 base::SequencedTaskRunner* file_task_runner, | 61 base::SequencedTaskRunner* file_task_runner, |
62 base::SingleThreadTaskRunner* io_task_runner, | 62 base::SingleThreadTaskRunner* io_task_runner, |
63 quota::SpecialStoragePolicy* special_storage_policy, | 63 quota::SpecialStoragePolicy* special_storage_policy, |
64 quota::QuotaManagerProxy* quota_manager_proxy, | 64 quota::QuotaManagerProxy* quota_manager_proxy, |
65 const FilePath& profile_path, | 65 const FilePath& profile_path, |
66 const FileSystemOptions& options); | 66 const FileSystemOptions& options); |
67 | 67 |
68 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); | 68 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); |
69 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, | |
70 FileSystemType type); | |
71 | 69 |
72 quota::QuotaManagerProxy* quota_manager_proxy() const { | 70 quota::QuotaManagerProxy* quota_manager_proxy() const { |
73 return quota_manager_proxy_.get(); | 71 return quota_manager_proxy_.get(); |
74 } | 72 } |
75 | 73 |
76 base::SequencedTaskRunner* file_task_runner() const { | 74 base::SequencedTaskRunner* file_task_runner() const { |
77 return file_task_runner_.get(); | 75 return file_task_runner_.get(); |
78 } | 76 } |
79 | 77 |
80 // Returns a quota util for a given filesystem type. This may | 78 // Returns a quota util for a given filesystem type. This may |
(...skipping 20 matching lines...) Expand all Loading... |
101 // Returns a FileSystemMountPointProvider instance for external filesystem | 99 // Returns a FileSystemMountPointProvider instance for external filesystem |
102 // type, which is used only by chromeos for now. This is equivalent to | 100 // type, which is used only by chromeos for now. This is equivalent to |
103 // calling GetMountPointProvider(kFileSystemTypeExternal). | 101 // calling GetMountPointProvider(kFileSystemTypeExternal). |
104 ExternalFileSystemMountPointProvider* external_provider() const; | 102 ExternalFileSystemMountPointProvider* external_provider() const; |
105 | 103 |
106 // Used for OpenFileSystem. | 104 // Used for OpenFileSystem. |
107 typedef base::Callback<void(base::PlatformFileError result, | 105 typedef base::Callback<void(base::PlatformFileError result, |
108 const std::string& name, | 106 const std::string& name, |
109 const GURL& root)> OpenFileSystemCallback; | 107 const GURL& root)> OpenFileSystemCallback; |
110 | 108 |
| 109 // Used for DeleteFileSystem. |
| 110 typedef base::Callback<void(base::PlatformFileError result)> |
| 111 DeleteFileSystemCallback; |
| 112 |
111 // Opens the filesystem for the given |origin_url| and |type|, and dispatches | 113 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
112 // the DidOpenFileSystem callback of the given |dispatcher|. | 114 // the DidOpenFileSystem callback of the given |dispatcher|. |
113 // If |create| is true this may actually set up a filesystem instance | 115 // If |create| is true this may actually set up a filesystem instance |
114 // (e.g. by creating the root directory or initializing the database | 116 // (e.g. by creating the root directory or initializing the database |
115 // entry etc). | 117 // entry etc). |
116 void OpenFileSystem( | 118 void OpenFileSystem( |
117 const GURL& origin_url, | 119 const GURL& origin_url, |
118 FileSystemType type, | 120 FileSystemType type, |
119 bool create, | 121 bool create, |
120 OpenFileSystemCallback callback); | 122 const OpenFileSystemCallback& callback); |
| 123 |
| 124 // Deletes the filesystem for the given |origin_url| and |type|. |
| 125 void DeleteFileSystem( |
| 126 const GURL& origin_url, |
| 127 FileSystemType type, |
| 128 const DeleteFileSystemCallback& callback); |
121 | 129 |
122 // Creates a new FileSystemOperation instance by cracking | 130 // Creates a new FileSystemOperation instance by cracking |
123 // the given filesystem URL |url| to get an appropriate MountPointProvider | 131 // the given filesystem URL |url| to get an appropriate MountPointProvider |
124 // and calling the provider's corresponding CreateFileSystemOperation method. | 132 // and calling the provider's corresponding CreateFileSystemOperation method. |
125 // The resolved MountPointProvider could perform further specialization | 133 // The resolved MountPointProvider could perform further specialization |
126 // depending on the filesystem type pointed by the |url|. | 134 // depending on the filesystem type pointed by the |url|. |
127 FileSystemOperationInterface* CreateFileSystemOperation( | 135 FileSystemOperationInterface* CreateFileSystemOperation( |
128 const FileSystemURL& url); | 136 const FileSystemURL& url); |
129 | 137 |
130 // Creates new FileStreamReader instance to read a file pointed by the given | 138 // Creates new FileStreamReader instance to read a file pointed by the given |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 177 |
170 struct DefaultContextDeleter { | 178 struct DefaultContextDeleter { |
171 static void Destruct(const FileSystemContext* context) { | 179 static void Destruct(const FileSystemContext* context) { |
172 context->DeleteOnCorrectThread(); | 180 context->DeleteOnCorrectThread(); |
173 } | 181 } |
174 }; | 182 }; |
175 | 183 |
176 } // namespace fileapi | 184 } // namespace fileapi |
177 | 185 |
178 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 186 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |