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_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "webkit/browser/fileapi/open_file_system_mode.h" |
15 #include "webkit/fileapi/file_permission_policy.h" | 16 #include "webkit/fileapi/file_permission_policy.h" |
16 #include "webkit/fileapi/file_system_types.h" | 17 #include "webkit/fileapi/file_system_types.h" |
17 #include "webkit/storage/webkit_storage_export.h" | 18 #include "webkit/storage/webkit_storage_export.h" |
18 | 19 |
19 namespace webkit_blob { | 20 namespace webkit_blob { |
20 class FileStreamReader; | 21 class FileStreamReader; |
21 } | 22 } |
22 | 23 |
23 namespace fileapi { | 24 namespace fileapi { |
24 | 25 |
25 class AsyncFileUtil; | 26 class AsyncFileUtil; |
26 class CopyOrMoveFileValidatorFactory; | 27 class CopyOrMoveFileValidatorFactory; |
27 class FileSystemURL; | 28 class FileSystemURL; |
28 class FileStreamWriter; | 29 class FileStreamWriter; |
29 class FileSystemContext; | 30 class FileSystemContext; |
30 class FileSystemFileUtil; | 31 class FileSystemFileUtil; |
31 class FileSystemOperation; | 32 class FileSystemOperation; |
32 class FileSystemQuotaUtil; | 33 class FileSystemQuotaUtil; |
33 class RemoteFileSystemProxyInterface; | 34 class RemoteFileSystemProxyInterface; |
34 | 35 |
35 // An interface to provide mount-point-specific path-related utilities | 36 // An interface to provide mount-point-specific path-related utilities |
36 // and specialized FileSystemFileUtil instance. | 37 // and specialized FileSystemFileUtil instance. |
37 // | 38 // |
38 // NOTE: when you implement a new MountPointProvider for your own | 39 // NOTE: when you implement a new MountPointProvider for your own |
39 // FileSystem module, please contact to kinuko@chromium.org. | 40 // FileSystem module, please contact to kinuko@chromium.org. |
40 // | 41 // |
41 class WEBKIT_STORAGE_EXPORT FileSystemMountPointProvider { | 42 class WEBKIT_STORAGE_EXPORT FileSystemMountPointProvider { |
42 public: | 43 public: |
43 // Callback for ValidateFileSystemRoot. | 44 // Callback for OpenFileSystem. |
44 typedef base::Callback<void(base::PlatformFileError error)> | 45 typedef base::Callback<void(base::PlatformFileError error)> |
45 ValidateFileSystemCallback; | 46 OpenFileSystemCallback; |
46 typedef base::Callback<void(base::PlatformFileError error)> | 47 typedef base::Callback<void(base::PlatformFileError error)> |
47 DeleteFileSystemCallback; | 48 DeleteFileSystemCallback; |
48 virtual ~FileSystemMountPointProvider() {} | 49 virtual ~FileSystemMountPointProvider() {} |
49 | 50 |
50 // Returns true if this mount point provider can handle |type|. | 51 // Returns true if this mount point provider can handle |type|. |
51 // One mount point provider may be able to handle multiple filesystem types. | 52 // One mount point provider may be able to handle multiple filesystem types. |
52 virtual bool CanHandleType(FileSystemType type) const = 0; | 53 virtual bool CanHandleType(FileSystemType type) const = 0; |
53 | 54 |
54 // Validates the filesystem for the given |origin_url| and |type|. | 55 // Initializes the filesystem for the given |origin_url| and |type|. |
55 // This verifies if it is allowed to request (or create) the filesystem | 56 // This verifies if it is allowed to request (or create) the filesystem |
56 // and if it can access (or create) the root directory of the mount point. | 57 // and if it can access (or create) the root directory of the mount point. |
57 // If |create| is true this may also create the root directory for | 58 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create |
| 59 // the root directory (and/or related database entries etc) for |
58 // the filesystem if it doesn't exist. | 60 // the filesystem if it doesn't exist. |
59 virtual void ValidateFileSystemRoot( | 61 virtual void OpenFileSystem( |
60 const GURL& origin_url, | 62 const GURL& origin_url, |
61 FileSystemType type, | 63 FileSystemType type, |
62 bool create, | 64 OpenFileSystemMode mode, |
63 const ValidateFileSystemCallback& callback) = 0; | 65 const OpenFileSystemCallback& callback) = 0; |
64 | 66 |
65 // Returns the specialized FileSystemFileUtil for this mount point. | 67 // Returns the specialized FileSystemFileUtil for this mount point. |
66 // It is ok to return NULL if the filesystem doesn't support synchronous | 68 // It is ok to return NULL if the filesystem doesn't support synchronous |
67 // version of FileUtil. | 69 // version of FileUtil. |
68 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) = 0; | 70 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) = 0; |
69 | 71 |
70 // Returns the specialized AsyncFileUtil for this mount point. | 72 // Returns the specialized AsyncFileUtil for this mount point. |
71 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; | 73 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; |
72 | 74 |
73 // Returns the specialized CopyOrMoveFileValidatorFactory for this mount | 75 // Returns the specialized CopyOrMoveFileValidatorFactory for this mount |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const std::string& extension_id) = 0; | 162 const std::string& extension_id) = 0; |
161 // Gets virtual path by known filesystem path. Returns false when filesystem | 163 // Gets virtual path by known filesystem path. Returns false when filesystem |
162 // path is not exposed by this provider. | 164 // path is not exposed by this provider. |
163 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 165 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
164 base::FilePath* virtual_path) = 0; | 166 base::FilePath* virtual_path) = 0; |
165 }; | 167 }; |
166 | 168 |
167 } // namespace fileapi | 169 } // namespace fileapi |
168 | 170 |
169 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 171 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |