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, and then checks the |
211 // existence of the file entry referred by the URL. This should be called on | 216 // existence of the file entry referred by the URL. Can be called from any |
212 // the IO thread. | 217 // thread with a message loop. |callback| is invoked on the caller thread. |
kinuko
2014/04/21 08:56:02
So the new contract is: this returns OK if the giv
kinaba
2014/04/21 09:21:59
Exactly. Updated the comment.
| |
213 void ResolveURL( | 218 void ResolveURL( |
214 const FileSystemURL& url, | 219 const FileSystemURL& url, |
215 const ResolveURLCallback& callback); | 220 const ResolveURLCallback& callback); |
216 | 221 |
217 // Attempts to mount the filesystem needed to satisfy |url_request| made | 222 // Attempts to mount the filesystem needed to satisfy |url_request| made |
218 // from |storage_domain|. If an appropriate file system is not found, | 223 // from |storage_domain|. If an appropriate file system is not found, |
219 // callback will return an error. | 224 // callback will return an error. |
220 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, | 225 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, |
221 const std::string& storage_domain, | 226 const std::string& storage_domain, |
222 const StatusCallback& callback); | 227 const StatusCallback& callback); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 | 406 |
402 struct DefaultContextDeleter { | 407 struct DefaultContextDeleter { |
403 static void Destruct(const FileSystemContext* context) { | 408 static void Destruct(const FileSystemContext* context) { |
404 context->DeleteOnCorrectThread(); | 409 context->DeleteOnCorrectThread(); |
405 } | 410 } |
406 }; | 411 }; |
407 | 412 |
408 } // namespace fileapi | 413 } // namespace fileapi |
409 | 414 |
410 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 415 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |