| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/sequenced_task_runner_helpers.h" | 17 #include "base/sequenced_task_runner_helpers.h" |
| 18 #include "webkit/browser/fileapi/file_system_url.h" | 18 #include "storage/browser/fileapi/file_system_url.h" |
| 19 #include "webkit/browser/fileapi/open_file_system_mode.h" | 19 #include "storage/browser/fileapi/open_file_system_mode.h" |
| 20 #include "webkit/browser/fileapi/plugin_private_file_system_backend.h" | 20 #include "storage/browser/fileapi/plugin_private_file_system_backend.h" |
| 21 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" | 21 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" |
| 22 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" | 22 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" |
| 23 #include "webkit/browser/webkit_storage_browser_export.h" | 23 #include "storage/common/storage_export.h" |
| 24 #include "webkit/common/fileapi/file_system_types.h" | 24 #include "storage/common/fileapi/file_system_types.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class FilePath; | 27 class FilePath; |
| 28 class SequencedTaskRunner; | 28 class SequencedTaskRunner; |
| 29 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace chrome { | 32 namespace chrome { |
| 33 class NativeMediaFileUtilTest; | 33 class NativeMediaFileUtilTest; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace quota { | 36 namespace quota { |
| 37 class QuotaManagerProxy; | 37 class QuotaManagerProxy; |
| 38 class SpecialStoragePolicy; | 38 class SpecialStoragePolicy; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace net { | 41 namespace net { |
| 42 class URLRequest; | 42 class URLRequest; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace webkit_blob { | 45 namespace storage { |
| 46 class BlobURLRequestJobTest; | 46 class BlobURLRequestJobTest; |
| 47 class FileStreamReader; | 47 class FileStreamReader; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace fileapi { | 50 namespace storage { |
| 51 | 51 |
| 52 class AsyncFileUtil; | 52 class AsyncFileUtil; |
| 53 class CopyOrMoveFileValidatorFactory; | 53 class CopyOrMoveFileValidatorFactory; |
| 54 class ExternalFileSystemBackend; | 54 class ExternalFileSystemBackend; |
| 55 class ExternalMountPoints; | 55 class ExternalMountPoints; |
| 56 class FileStreamWriter; | 56 class FileStreamWriter; |
| 57 class FileSystemBackend; | 57 class FileSystemBackend; |
| 58 class FileSystemFileUtil; | 58 class FileSystemFileUtil; |
| 59 class FileSystemOperation; | 59 class FileSystemOperation; |
| 60 class FileSystemOperationRunner; | 60 class FileSystemOperationRunner; |
| 61 class FileSystemOptions; | 61 class FileSystemOptions; |
| 62 class FileSystemQuotaUtil; | 62 class FileSystemQuotaUtil; |
| 63 class FileSystemURL; | 63 class FileSystemURL; |
| 64 class IsolatedFileSystemBackend; | 64 class IsolatedFileSystemBackend; |
| 65 class MountPoints; | 65 class MountPoints; |
| 66 class QuotaReservation; | 66 class QuotaReservation; |
| 67 class SandboxFileSystemBackend; | 67 class SandboxFileSystemBackend; |
| 68 | 68 |
| 69 struct DefaultContextDeleter; | 69 struct DefaultContextDeleter; |
| 70 struct FileSystemInfo; | 70 struct FileSystemInfo; |
| 71 | 71 |
| 72 // An auto mount handler will attempt to mount the file system requested in | 72 // An auto mount handler will attempt to mount the file system requested in |
| 73 // |url_request|. If the URL is for this auto mount handler, it returns true | 73 // |url_request|. If the URL is for this auto mount handler, it returns true |
| 74 // and calls |callback| when the attempt is complete. If the auto mounter | 74 // and calls |callback| when the attempt is complete. If the auto mounter |
| 75 // does not recognize the URL, it returns false and does not call |callback|. | 75 // does not recognize the URL, it returns false and does not call |callback|. |
| 76 // Called on the IO thread. | 76 // Called on the IO thread. |
| 77 typedef base::Callback<bool( | 77 typedef base::Callback< |
| 78 const net::URLRequest* url_request, | 78 bool(const net::URLRequest* url_request, |
| 79 const FileSystemURL& filesystem_url, | 79 const FileSystemURL& filesystem_url, |
| 80 const std::string& storage_domain, | 80 const std::string& storage_domain, |
| 81 const base::Callback<void(base::File::Error result)>& callback)> | 81 const base::Callback<void(base::File::Error result)>& callback)> |
| 82 URLRequestAutoMountHandler; | 82 URLRequestAutoMountHandler; |
| 83 | 83 |
| 84 // This class keeps and provides a file system context for FileSystem API. | 84 // This class keeps and provides a file system context for FileSystem API. |
| 85 // An instance of this class is created and owned by profile. | 85 // An instance of this class is created and owned by profile. |
| 86 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext | 86 class STORAGE_EXPORT FileSystemContext |
| 87 : public base::RefCountedThreadSafe<FileSystemContext, | 87 : public base::RefCountedThreadSafe<FileSystemContext, |
| 88 DefaultContextDeleter> { | 88 DefaultContextDeleter> { |
| 89 public: | 89 public: |
| 90 // Returns file permission policy we should apply for the given |type|. | 90 // Returns file permission policy we should apply for the given |type|. |
| 91 // The return value must be bitwise-or'd of FilePermissionPolicy. | 91 // The return value must be bitwise-or'd of FilePermissionPolicy. |
| 92 // | 92 // |
| 93 // Note: if a part of a filesystem is returned via 'Isolated' mount point, | 93 // Note: if a part of a filesystem is returned via 'Isolated' mount point, |
| 94 // its per-filesystem permission overrides the underlying filesystem's | 94 // its per-filesystem permission overrides the underlying filesystem's |
| 95 // permission policy. | 95 // permission policy. |
| 96 static int GetPermissionPolicy(FileSystemType type); | 96 static int GetPermissionPolicy(FileSystemType type); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // it is not a quota-managed storage. | 148 // it is not a quota-managed storage. |
| 149 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; | 149 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; |
| 150 | 150 |
| 151 // Returns the appropriate AsyncFileUtil instance for the given |type|. | 151 // Returns the appropriate AsyncFileUtil instance for the given |type|. |
| 152 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) const; | 152 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) const; |
| 153 | 153 |
| 154 // Returns the appropriate CopyOrMoveFileValidatorFactory for the given | 154 // Returns the appropriate CopyOrMoveFileValidatorFactory for the given |
| 155 // |type|. If |error_code| is File::FILE_OK and the result is NULL, | 155 // |type|. If |error_code| is File::FILE_OK and the result is NULL, |
| 156 // then no validator is required. | 156 // then no validator is required. |
| 157 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 157 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
| 158 FileSystemType type, base::File::Error* error_code) const; | 158 FileSystemType type, |
| 159 base::File::Error* error_code) const; |
| 159 | 160 |
| 160 // Returns the file system backend instance for the given |type|. | 161 // Returns the file system backend instance for the given |type|. |
| 161 // This may return NULL if it is given an invalid or unsupported filesystem | 162 // This may return NULL if it is given an invalid or unsupported filesystem |
| 162 // type. | 163 // type. |
| 163 FileSystemBackend* GetFileSystemBackend( | 164 FileSystemBackend* GetFileSystemBackend(FileSystemType type) const; |
| 164 FileSystemType type) const; | |
| 165 | 165 |
| 166 // Returns true for sandboxed filesystems. Currently this does | 166 // Returns true for sandboxed filesystems. Currently this does |
| 167 // the same as GetQuotaUtil(type) != NULL. (In an assumption that | 167 // the same as GetQuotaUtil(type) != NULL. (In an assumption that |
| 168 // all sandboxed filesystems must cooperate with QuotaManager so that | 168 // all sandboxed filesystems must cooperate with QuotaManager so that |
| 169 // they can get deleted) | 169 // they can get deleted) |
| 170 bool IsSandboxFileSystem(FileSystemType type) const; | 170 bool IsSandboxFileSystem(FileSystemType type) const; |
| 171 | 171 |
| 172 // Returns observers for the given filesystem type. | 172 // Returns observers for the given filesystem type. |
| 173 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const; | 173 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const; |
| 174 const AccessObserverList* GetAccessObservers(FileSystemType type) const; | 174 const AccessObserverList* GetAccessObservers(FileSystemType type) const; |
| 175 | 175 |
| 176 // Returns all registered filesystem types. | 176 // Returns all registered filesystem types. |
| 177 void GetFileSystemTypes(std::vector<FileSystemType>* types) const; | 177 void GetFileSystemTypes(std::vector<FileSystemType>* types) const; |
| 178 | 178 |
| 179 // Returns a FileSystemBackend instance for external filesystem | 179 // Returns a FileSystemBackend instance for external filesystem |
| 180 // type, which is used only by chromeos for now. This is equivalent to | 180 // type, which is used only by chromeos for now. This is equivalent to |
| 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< |
| 186 const std::string& name, | 186 void(const GURL& root, const std::string& name, base::File::Error result)> |
| 187 base::File::Error result)> | |
| 188 OpenFileSystemCallback; | 187 OpenFileSystemCallback; |
| 189 | 188 |
| 190 // Used for ResolveURL. | 189 // Used for ResolveURL. |
| 191 enum ResolvedEntryType { | 190 enum ResolvedEntryType { |
| 192 RESOLVED_ENTRY_FILE, | 191 RESOLVED_ENTRY_FILE, |
| 193 RESOLVED_ENTRY_DIRECTORY, | 192 RESOLVED_ENTRY_DIRECTORY, |
| 194 RESOLVED_ENTRY_NOT_FOUND, | 193 RESOLVED_ENTRY_NOT_FOUND, |
| 195 }; | 194 }; |
| 196 typedef base::Callback<void(base::File::Error result, | 195 typedef base::Callback<void(base::File::Error result, |
| 197 const FileSystemInfo& info, | 196 const FileSystemInfo& info, |
| 198 const base::FilePath& file_path, | 197 const base::FilePath& file_path, |
| 199 ResolvedEntryType type)> ResolveURLCallback; | 198 ResolvedEntryType type)> ResolveURLCallback; |
| 200 | 199 |
| 201 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem. | 200 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem. |
| 202 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 201 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
| 203 | 202 |
| 204 // Opens the filesystem for the given |origin_url| and |type|, and dispatches | 203 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
| 205 // |callback| on completion. | 204 // |callback| on completion. |
| 206 // If |create| is true this may actually set up a filesystem instance | 205 // If |create| is true this may actually set up a filesystem instance |
| 207 // (e.g. by creating the root directory or initializing the database | 206 // (e.g. by creating the root directory or initializing the database |
| 208 // entry etc). | 207 // entry etc). |
| 209 void OpenFileSystem( | 208 void OpenFileSystem(const GURL& origin_url, |
| 210 const GURL& origin_url, | 209 FileSystemType type, |
| 211 FileSystemType type, | 210 OpenFileSystemMode mode, |
| 212 OpenFileSystemMode mode, | 211 const OpenFileSystemCallback& callback); |
| 213 const OpenFileSystemCallback& callback); | |
| 214 | 212 |
| 215 // Opens the filesystem for the given |url| as read-only, if the filesystem | 213 // Opens the filesystem for the given |url| as read-only, if the filesystem |
| 216 // backend referred by the URL allows opening by resolveURL. Otherwise it | 214 // backend referred by the URL allows opening by resolveURL. Otherwise it |
| 217 // fails with FILE_ERROR_SECURITY. The entry pointed by the URL can be | 215 // 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 | 216 // 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 | 217 // callback for indicating the absence. Can be called from any thread with |
| 220 // a message loop. |callback| is invoked on the caller thread. | 218 // a message loop. |callback| is invoked on the caller thread. |
| 221 void ResolveURL( | 219 void ResolveURL(const FileSystemURL& url, const ResolveURLCallback& callback); |
| 222 const FileSystemURL& url, | |
| 223 const ResolveURLCallback& callback); | |
| 224 | 220 |
| 225 // Attempts to mount the filesystem needed to satisfy |url_request| made | 221 // Attempts to mount the filesystem needed to satisfy |url_request| made |
| 226 // from |storage_domain|. If an appropriate file system is not found, | 222 // from |storage_domain|. If an appropriate file system is not found, |
| 227 // callback will return an error. | 223 // callback will return an error. |
| 228 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, | 224 void AttemptAutoMountForURLRequest(const net::URLRequest* url_request, |
| 229 const std::string& storage_domain, | 225 const std::string& storage_domain, |
| 230 const StatusCallback& callback); | 226 const StatusCallback& callback); |
| 231 | 227 |
| 232 // Deletes the filesystem for the given |origin_url| and |type|. This should | 228 // Deletes the filesystem for the given |origin_url| and |type|. This should |
| 233 // be called on the IO thread. | 229 // be called on the IO thread. |
| 234 void DeleteFileSystem( | 230 void DeleteFileSystem(const GURL& origin_url, |
| 235 const GURL& origin_url, | 231 FileSystemType type, |
| 236 FileSystemType type, | 232 const StatusCallback& callback); |
| 237 const StatusCallback& callback); | |
| 238 | 233 |
| 239 // Creates new FileStreamReader instance to read a file pointed by the given | 234 // Creates new FileStreamReader instance to read a file pointed by the given |
| 240 // filesystem URL |url| starting from |offset|. |expected_modification_time| | 235 // filesystem URL |url| starting from |offset|. |expected_modification_time| |
| 241 // specifies the expected last modification if the value is non-null, the | 236 // specifies the expected last modification if the value is non-null, the |
| 242 // reader will check the underlying file's actual modification time to see if | 237 // reader will check the underlying file's actual modification time to see if |
| 243 // the file has been modified, and if it does any succeeding read operations | 238 // the file has been modified, and if it does any succeeding read operations |
| 244 // should fail with ERR_UPLOAD_FILE_CHANGED error. | 239 // should fail with ERR_UPLOAD_FILE_CHANGED error. |
| 245 // This method internally cracks the |url|, get an appropriate | 240 // This method internally cracks the |url|, get an appropriate |
| 246 // FileSystemBackend for the URL and call the backend's CreateFileReader. | 241 // FileSystemBackend for the URL and call the backend's CreateFileReader. |
| 247 // The resolved FileSystemBackend could perform further specialization | 242 // The resolved FileSystemBackend could perform further specialization |
| 248 // depending on the filesystem type pointed by the |url|. | 243 // depending on the filesystem type pointed by the |url|. |
| 249 scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 244 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 250 const FileSystemURL& url, | 245 const FileSystemURL& url, |
| 251 int64 offset, | 246 int64 offset, |
| 252 const base::Time& expected_modification_time); | 247 const base::Time& expected_modification_time); |
| 253 | 248 |
| 254 // Creates new FileStreamWriter instance to write into a file pointed by | 249 // Creates new FileStreamWriter instance to write into a file pointed by |
| 255 // |url| from |offset|. | 250 // |url| from |offset|. |
| 256 scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 251 scoped_ptr<FileStreamWriter> CreateFileStreamWriter(const FileSystemURL& url, |
| 257 const FileSystemURL& url, | 252 int64 offset); |
| 258 int64 offset); | |
| 259 | 253 |
| 260 // Creates a new FileSystemOperationRunner. | 254 // Creates a new FileSystemOperationRunner. |
| 261 scoped_ptr<FileSystemOperationRunner> CreateFileSystemOperationRunner(); | 255 scoped_ptr<FileSystemOperationRunner> CreateFileSystemOperationRunner(); |
| 262 | 256 |
| 263 base::SequencedTaskRunner* default_file_task_runner() { | 257 base::SequencedTaskRunner* default_file_task_runner() { |
| 264 return default_file_task_runner_.get(); | 258 return default_file_task_runner_.get(); |
| 265 } | 259 } |
| 266 | 260 |
| 267 FileSystemOperationRunner* operation_runner() { | 261 FileSystemOperationRunner* operation_runner() { |
| 268 return operation_runner_.get(); | 262 return operation_runner_.get(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 290 // Returns true if the requested url is ok to be served. | 284 // Returns true if the requested url is ok to be served. |
| 291 // (E.g. this returns false if the context is created for incognito mode) | 285 // (E.g. this returns false if the context is created for incognito mode) |
| 292 bool CanServeURLRequest(const FileSystemURL& url) const; | 286 bool CanServeURLRequest(const FileSystemURL& url) const; |
| 293 | 287 |
| 294 // Returns true if a file in the file system should be flushed for each write | 288 // Returns true if a file in the file system should be flushed for each write |
| 295 // completion. | 289 // completion. |
| 296 bool ShouldFlushOnWriteCompletion(FileSystemType type) const; | 290 bool ShouldFlushOnWriteCompletion(FileSystemType type) const; |
| 297 | 291 |
| 298 // This must be used to open 'plugin private' filesystem. | 292 // This must be used to open 'plugin private' filesystem. |
| 299 // See "plugin_private_file_system_backend.h" for more details. | 293 // See "plugin_private_file_system_backend.h" for more details. |
| 300 void OpenPluginPrivateFileSystem( | 294 void OpenPluginPrivateFileSystem(const GURL& origin_url, |
| 301 const GURL& origin_url, | 295 FileSystemType type, |
| 302 FileSystemType type, | 296 const std::string& filesystem_id, |
| 303 const std::string& filesystem_id, | 297 const std::string& plugin_id, |
| 304 const std::string& plugin_id, | 298 OpenFileSystemMode mode, |
| 305 OpenFileSystemMode mode, | 299 const StatusCallback& callback); |
| 306 const StatusCallback& callback); | |
| 307 | 300 |
| 308 private: | 301 private: |
| 309 typedef std::map<FileSystemType, FileSystemBackend*> | 302 typedef std::map<FileSystemType, FileSystemBackend*> FileSystemBackendMap; |
| 310 FileSystemBackendMap; | |
| 311 | 303 |
| 312 // For CreateFileSystemOperation. | 304 // For CreateFileSystemOperation. |
| 313 friend class FileSystemOperationRunner; | 305 friend class FileSystemOperationRunner; |
| 314 | 306 |
| 315 // For sandbox_backend(). | 307 // For sandbox_backend(). |
| 316 friend class content::SandboxFileSystemTestHelper; | 308 friend class content::SandboxFileSystemTestHelper; |
| 317 | 309 |
| 318 // For plugin_private_backend(). | 310 // For plugin_private_backend(). |
| 319 friend class content::PluginPrivateFileSystemBackendTest; | 311 friend class content::PluginPrivateFileSystemBackendTest; |
| 320 | 312 |
| 321 // Deleters. | 313 // Deleters. |
| 322 friend struct DefaultContextDeleter; | 314 friend struct DefaultContextDeleter; |
| 323 friend class base::DeleteHelper<FileSystemContext>; | 315 friend class base::DeleteHelper<FileSystemContext>; |
| 324 friend class base::RefCountedThreadSafe<FileSystemContext, | 316 friend class base::RefCountedThreadSafe<FileSystemContext, |
| 325 DefaultContextDeleter>; | 317 DefaultContextDeleter>; |
| 326 ~FileSystemContext(); | 318 ~FileSystemContext(); |
| 327 | 319 |
| 328 void DeleteOnCorrectThread() const; | 320 void DeleteOnCorrectThread() const; |
| 329 | 321 |
| 330 // Creates a new FileSystemOperation instance by getting an appropriate | 322 // Creates a new FileSystemOperation instance by getting an appropriate |
| 331 // FileSystemBackend for |url| and calling the backend's corresponding | 323 // FileSystemBackend for |url| and calling the backend's corresponding |
| 332 // CreateFileSystemOperation method. | 324 // CreateFileSystemOperation method. |
| 333 // The resolved FileSystemBackend could perform further specialization | 325 // The resolved FileSystemBackend could perform further specialization |
| 334 // depending on the filesystem type pointed by the |url|. | 326 // depending on the filesystem type pointed by the |url|. |
| 335 // | 327 // |
| 336 // Called by FileSystemOperationRunner. | 328 // Called by FileSystemOperationRunner. |
| 337 FileSystemOperation* CreateFileSystemOperation( | 329 FileSystemOperation* CreateFileSystemOperation(const FileSystemURL& url, |
| 338 const FileSystemURL& url, | 330 base::File::Error* error_code); |
| 339 base::File::Error* error_code); | |
| 340 | 331 |
| 341 // For non-cracked isolated and external mount points, returns a FileSystemURL | 332 // For non-cracked isolated and external mount points, returns a FileSystemURL |
| 342 // created by cracking |url|. The url is cracked using MountPoints registered | 333 // created by cracking |url|. The url is cracked using MountPoints registered |
| 343 // as |url_crackers_|. If the url cannot be cracked, returns invalid | 334 // as |url_crackers_|. If the url cannot be cracked, returns invalid |
| 344 // FileSystemURL. | 335 // FileSystemURL. |
| 345 // | 336 // |
| 346 // If the original url does not point to an isolated or external filesystem, | 337 // If the original url does not point to an isolated or external filesystem, |
| 347 // returns the original url, without attempting to crack it. | 338 // returns the original url, without attempting to crack it. |
| 348 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; | 339 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; |
| 349 | 340 |
| 350 // For initial backend_map construction. This must be called only from | 341 // For initial backend_map construction. This must be called only from |
| 351 // the constructor. | 342 // the constructor. |
| 352 void RegisterBackend(FileSystemBackend* backend); | 343 void RegisterBackend(FileSystemBackend* backend); |
| 353 | 344 |
| 354 void DidOpenFileSystemForResolveURL( | 345 void DidOpenFileSystemForResolveURL(const FileSystemURL& url, |
| 355 const FileSystemURL& url, | 346 const ResolveURLCallback& callback, |
| 356 const ResolveURLCallback& callback, | 347 const GURL& filesystem_root, |
| 357 const GURL& filesystem_root, | 348 const std::string& filesystem_name, |
| 358 const std::string& filesystem_name, | 349 base::File::Error error); |
| 359 base::File::Error error); | |
| 360 | 350 |
| 361 // Returns a FileSystemBackend, used only by test code. | 351 // Returns a FileSystemBackend, used only by test code. |
| 362 SandboxFileSystemBackend* sandbox_backend() const { | 352 SandboxFileSystemBackend* sandbox_backend() const { |
| 363 return sandbox_backend_.get(); | 353 return sandbox_backend_.get(); |
| 364 } | 354 } |
| 365 | 355 |
| 366 // Used only by test code. | 356 // Used only by test code. |
| 367 PluginPrivateFileSystemBackend* plugin_private_backend() const { | 357 PluginPrivateFileSystemBackend* plugin_private_backend() const { |
| 368 return plugin_private_backend_.get(); | 358 return plugin_private_backend_.get(); |
| 369 } | 359 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 400 |
| 411 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 401 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 412 }; | 402 }; |
| 413 | 403 |
| 414 struct DefaultContextDeleter { | 404 struct DefaultContextDeleter { |
| 415 static void Destruct(const FileSystemContext* context) { | 405 static void Destruct(const FileSystemContext* context) { |
| 416 context->DeleteOnCorrectThread(); | 406 context->DeleteOnCorrectThread(); |
| 417 } | 407 } |
| 418 }; | 408 }; |
| 419 | 409 |
| 420 } // namespace fileapi | 410 } // namespace storage |
| 421 | 411 |
| 422 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 412 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |