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_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // calling GetFileSystemBackend(kFileSystemTypeExternal). | 181 // calling GetFileSystemBackend(kFileSystemTypeExternal). |
182 ExternalFileSystemBackend* external_backend() const; | 182 ExternalFileSystemBackend* external_backend() const; |
183 | 183 |
184 // Used for OpenFileSystem. | 184 // Used for OpenFileSystem. |
185 typedef base::Callback<void(const GURL& root, | 185 typedef base::Callback<void(const GURL& root, |
186 const std::string& name, | 186 const std::string& name, |
187 base::File::Error result)> | 187 base::File::Error result)> |
188 OpenFileSystemCallback; | 188 OpenFileSystemCallback; |
189 | 189 |
190 // Used for ResolveURL. | 190 // Used for ResolveURL. |
| 191 enum ResolvedEntryType { |
| 192 RESOLVED_ENTRY_FILE, |
| 193 RESOLVED_ENTRY_DIRECTORY, |
| 194 RESOLVED_ENTRY_NOT_FOUND, |
| 195 }; |
191 typedef base::Callback<void(base::File::Error result, | 196 typedef base::Callback<void(base::File::Error result, |
192 const FileSystemInfo& info, | 197 const FileSystemInfo& info, |
193 const base::FilePath& file_path, | 198 const base::FilePath& file_path, |
194 bool is_directory)> ResolveURLCallback; | 199 ResolvedEntryType type)> ResolveURLCallback; |
195 | 200 |
196 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem. | 201 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem. |
197 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 202 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
198 | 203 |
199 // Opens the filesystem for the given |origin_url| and |type|, and dispatches | 204 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
200 // |callback| on completion. | 205 // |callback| on completion. |
201 // If |create| is true this may actually set up a filesystem instance | 206 // If |create| is true this may actually set up a filesystem instance |
202 // (e.g. by creating the root directory or initializing the database | 207 // (e.g. by creating the root directory or initializing the database |
203 // entry etc). | 208 // entry etc). |
204 void OpenFileSystem( | 209 void OpenFileSystem( |
205 const GURL& origin_url, | 210 const GURL& origin_url, |
206 FileSystemType type, | 211 FileSystemType type, |
207 OpenFileSystemMode mode, | 212 OpenFileSystemMode mode, |
208 const OpenFileSystemCallback& callback); | 213 const OpenFileSystemCallback& callback); |
209 | 214 |
210 // Opens the filesystem for the given |url| as read-only, and then checks the | 215 // Opens the filesystem for the given |url| as read-only, if the filesystem |
211 // existence of the file entry referred by the URL. This should be called on | 216 // backend referred by the URL allows opening by resolveURL. Otherwise it |
212 // the IO thread. | 217 // fails with FILE_ERROR_SECURITY. The entry pointed by the URL can be |
| 218 // absent; in that case RESOLVED_ENTRY_NOT_FOUND type is returned to the |
| 219 // callback for indicating the absence. Can be called from any thread with |
| 220 // a message loop. |callback| is invoked on the caller thread. |
213 void ResolveURL( | 221 void ResolveURL( |
214 const FileSystemURL& url, | 222 const FileSystemURL& url, |
215 const ResolveURLCallback& callback); | 223 const ResolveURLCallback& callback); |
216 | 224 |
217 // Attempts to mount the filesystem needed to satisfy |url_request| made | 225 // Attempts to mount the filesystem needed to satisfy |url_request| made |
218 // from |storage_domain|. If an appropriate file system is not found, | 226 // from |storage_domain|. If an appropriate file system is not found, |
219 // callback will return an error. | 227 // callback will return an error. |
220 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, | 228 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, |
221 const std::string& storage_domain, | 229 const std::string& storage_domain, |
222 const StatusCallback& callback); | 230 const StatusCallback& callback); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 409 |
402 struct DefaultContextDeleter { | 410 struct DefaultContextDeleter { |
403 static void Destruct(const FileSystemContext* context) { | 411 static void Destruct(const FileSystemContext* context) { |
404 context->DeleteOnCorrectThread(); | 412 context->DeleteOnCorrectThread(); |
405 } | 413 } |
406 }; | 414 }; |
407 | 415 |
408 } // namespace fileapi | 416 } // namespace fileapi |
409 | 417 |
410 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 418 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |