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 15 matching lines...) Expand all Loading... |
26 namespace storage { | 26 namespace storage { |
27 | 27 |
28 class AsyncFileUtil; | 28 class AsyncFileUtil; |
29 class CopyOrMoveFileValidatorFactory; | 29 class CopyOrMoveFileValidatorFactory; |
30 class FileSystemURL; | 30 class FileSystemURL; |
31 class FileStreamWriter; | 31 class FileStreamWriter; |
32 class FileSystemContext; | 32 class FileSystemContext; |
33 class FileSystemFileUtil; | 33 class FileSystemFileUtil; |
34 class FileSystemOperation; | 34 class FileSystemOperation; |
35 class FileSystemQuotaUtil; | 35 class FileSystemQuotaUtil; |
| 36 class WatcherManager; |
36 | 37 |
37 // An interface for defining a file system backend. | 38 // An interface for defining a file system backend. |
38 // | 39 // |
39 // NOTE: when you implement a new FileSystemBackend for your own | 40 // NOTE: when you implement a new FileSystemBackend for your own |
40 // FileSystem module, please contact to kinuko@chromium.org. | 41 // FileSystem module, please contact to kinuko@chromium.org. |
41 // | 42 // |
42 class STORAGE_EXPORT FileSystemBackend { | 43 class STORAGE_EXPORT FileSystemBackend { |
43 public: | 44 public: |
44 // Callback for InitializeFileSystem. | 45 // Callback for InitializeFileSystem. |
45 typedef base::Callback<void(const GURL& root_url, | 46 typedef base::Callback<void(const GURL& root_url, |
(...skipping 17 matching lines...) Expand all Loading... |
63 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create the root | 64 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create the root |
64 // directory (and/or related database entries etc) for the filesystem if it | 65 // directory (and/or related database entries etc) for the filesystem if it |
65 // doesn't exist. | 66 // doesn't exist. |
66 virtual void ResolveURL(const FileSystemURL& url, | 67 virtual void ResolveURL(const FileSystemURL& url, |
67 OpenFileSystemMode mode, | 68 OpenFileSystemMode mode, |
68 const OpenFileSystemCallback& callback) = 0; | 69 const OpenFileSystemCallback& callback) = 0; |
69 | 70 |
70 // Returns the specialized AsyncFileUtil for this backend. | 71 // Returns the specialized AsyncFileUtil for this backend. |
71 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; | 72 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; |
72 | 73 |
| 74 // Returns the specialized WatcherManager for this backend. |
| 75 virtual WatcherManager* GetWatcherManager(FileSystemType type) = 0; |
| 76 |
73 // Returns the specialized CopyOrMoveFileValidatorFactory for this backend | 77 // Returns the specialized CopyOrMoveFileValidatorFactory for this backend |
74 // and |type|. If |error_code| is File::FILE_OK and the result is NULL, | 78 // and |type|. If |error_code| is File::FILE_OK and the result is NULL, |
75 // then no validator is required. | 79 // then no validator is required. |
76 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 80 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
77 FileSystemType type, base::File::Error* error_code) = 0; | 81 FileSystemType type, base::File::Error* error_code) = 0; |
78 | 82 |
79 // Returns a new instance of the specialized FileSystemOperation for this | 83 // Returns a new instance of the specialized FileSystemOperation for this |
80 // backend based on the given triplet of |origin_url|, |file_system_type| | 84 // backend based on the given triplet of |origin_url|, |file_system_type| |
81 // and |virtual_path|. On failure to create a file system operation, set | 85 // and |virtual_path|. On failure to create a file system operation, set |
82 // |error_code| correspondingly. | 86 // |error_code| correspondingly. |
(...skipping 15 matching lines...) Expand all Loading... |
98 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; | 102 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; |
99 | 103 |
100 // Creates a new file stream reader for a given filesystem URL |url| with an | 104 // Creates a new file stream reader for a given filesystem URL |url| with an |
101 // offset |offset|. |expected_modification_time| specifies the expected last | 105 // offset |offset|. |expected_modification_time| specifies the expected last |
102 // modification if the value is non-null, the reader will check the underlying | 106 // modification if the value is non-null, the reader will check the underlying |
103 // file's actual modification time to see if the file has been modified, and | 107 // file's actual modification time to see if the file has been modified, and |
104 // if it does any succeeding read operations should fail with | 108 // if it does any succeeding read operations should fail with |
105 // ERR_UPLOAD_FILE_CHANGED error. | 109 // ERR_UPLOAD_FILE_CHANGED error. |
106 // This method itself does *not* check if the given path exists and is a | 110 // This method itself does *not* check if the given path exists and is a |
107 // regular file. | 111 // regular file. |
| 112 // The |length| argument says how many bytes are going to be read using the |
| 113 // instance of the file stream reader. If unknown, then equal to -1. |
108 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 114 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
109 const FileSystemURL& url, | 115 const FileSystemURL& url, |
110 int64 offset, | 116 int64 offset, |
111 const base::Time& expected_modification_time, | 117 const base::Time& expected_modification_time, |
112 FileSystemContext* context) const = 0; | 118 FileSystemContext* context) const = 0; |
113 | 119 |
114 // Creates a new file stream writer for a given filesystem URL |url| with an | 120 // Creates a new file stream writer for a given filesystem URL |url| with an |
115 // offset |offset|. | 121 // offset |offset|. |
116 // This method itself does *not* check if the given path exists and is a | 122 // This method itself does *not* check if the given path exists and is a |
117 // regular file. | 123 // regular file. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 const std::string& extension_id) = 0; | 155 const std::string& extension_id) = 0; |
150 // Gets virtual path by known filesystem path. Returns false when filesystem | 156 // Gets virtual path by known filesystem path. Returns false when filesystem |
151 // path is not exposed by this provider. | 157 // path is not exposed by this provider. |
152 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 158 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
153 base::FilePath* virtual_path) = 0; | 159 base::FilePath* virtual_path) = 0; |
154 }; | 160 }; |
155 | 161 |
156 } // namespace storage | 162 } // namespace storage |
157 | 163 |
158 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 164 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |