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_BACKEND_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // NOTE: when you implement a new FileSystemBackend for your own | 40 // NOTE: when you implement a new FileSystemBackend for your own |
41 // FileSystem module, please contact to kinuko@chromium.org. | 41 // FileSystem module, please contact to kinuko@chromium.org. |
42 // | 42 // |
43 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemBackend { | 43 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemBackend { |
44 public: | 44 public: |
45 // Callback for InitializeFileSystem. | 45 // Callback for InitializeFileSystem. |
46 typedef base::Callback<void(const GURL& root_url, | 46 typedef base::Callback<void(const GURL& root_url, |
47 const std::string& name, | 47 const std::string& name, |
48 base::PlatformFileError error)> | 48 base::PlatformFileError error)> |
49 InitializeFileSystemCallback; | 49 OpenFileSystemCallback; |
50 virtual ~FileSystemBackend() {} | 50 virtual ~FileSystemBackend() {} |
51 | 51 |
52 // Returns true if this mount point provider can handle |type|. | 52 // Returns true if this mount point provider can handle |type|. |
53 // One mount point provider may be able to handle multiple filesystem types. | 53 // One mount point provider may be able to handle multiple filesystem types. |
54 virtual bool CanHandleType(FileSystemType type) const = 0; | 54 virtual bool CanHandleType(FileSystemType type) const = 0; |
55 | 55 |
56 // Initializes the filesystem for the given |origin_url| and |type|. | 56 // This method is called right after the backend is registered in the |
| 57 // FileSystemContext and before any other methods are called. Each backend can |
| 58 // do additional initialization which depends on FileSystemContext here. |
| 59 virtual void Initialize(FileSystemContext* context) = 0; |
| 60 |
| 61 // Opens the filesystem for the given |origin_url| and |type|. |
57 // This verifies if it is allowed to request (or create) the filesystem | 62 // This verifies if it is allowed to request (or create) the filesystem |
58 // and if it can access (or create) the root directory of the mount point. | 63 // and if it can access (or create) the root directory of the mount point. |
59 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create | 64 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create |
60 // the root directory (and/or related database entries etc) for | 65 // the root directory (and/or related database entries etc) for |
61 // the filesystem if it doesn't exist. | 66 // the filesystem if it doesn't exist. |
62 virtual void InitializeFileSystem( | 67 virtual void OpenFileSystem( |
63 const GURL& origin_url, | 68 const GURL& origin_url, |
64 FileSystemType type, | 69 FileSystemType type, |
65 OpenFileSystemMode mode, | 70 OpenFileSystemMode mode, |
66 FileSystemContext* context, | 71 const OpenFileSystemCallback& callback) = 0; |
67 const InitializeFileSystemCallback& callback) = 0; | |
68 | 72 |
69 // Returns the specialized FileSystemFileUtil for this mount point. | 73 // Returns the specialized FileSystemFileUtil for this mount point. |
70 // It is ok to return NULL if the filesystem doesn't support synchronous | 74 // It is ok to return NULL if the filesystem doesn't support synchronous |
71 // version of FileUtil. | 75 // version of FileUtil. |
72 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) = 0; | 76 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) = 0; |
73 | 77 |
74 // Returns the specialized AsyncFileUtil for this mount point. | 78 // Returns the specialized AsyncFileUtil for this mount point. |
75 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; | 79 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; |
76 | 80 |
77 // Returns the specialized CopyOrMoveFileValidatorFactory for this mount | 81 // Returns the specialized CopyOrMoveFileValidatorFactory for this mount |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 const std::string& extension_id) = 0; | 147 const std::string& extension_id) = 0; |
144 // Gets virtual path by known filesystem path. Returns false when filesystem | 148 // Gets virtual path by known filesystem path. Returns false when filesystem |
145 // path is not exposed by this provider. | 149 // path is not exposed by this provider. |
146 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 150 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
147 base::FilePath* virtual_path) = 0; | 151 base::FilePath* virtual_path) = 0; |
148 }; | 152 }; |
149 | 153 |
150 } // namespace fileapi | 154 } // namespace fileapi |
151 | 155 |
152 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 156 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |