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 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "webkit/browser/fileapi/file_permission_policy.h" | 15 #include "webkit/browser/fileapi/file_permission_policy.h" |
16 #include "webkit/browser/fileapi/open_file_system_mode.h" | 16 #include "webkit/browser/fileapi/open_file_system_mode.h" |
17 #include "webkit/browser/webkit_storage_browser_export.h" | 17 #include "webkit/browser/webkit_storage_browser_export.h" |
18 #include "webkit/common/fileapi/file_system_types.h" | 18 #include "webkit/common/fileapi/file_system_types.h" |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 | 21 |
22 namespace webkit_blob { | 22 namespace storage { |
23 class FileStreamReader; | 23 class FileStreamReader; |
24 } | 24 } |
25 | 25 |
26 namespace fileapi { | 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 | 36 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; | 98 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; |
99 | 99 |
100 // Creates a new file stream reader for a given filesystem URL |url| with an | 100 // Creates a new file stream reader for a given filesystem URL |url| with an |
101 // offset |offset|. |expected_modification_time| specifies the expected last | 101 // offset |offset|. |expected_modification_time| specifies the expected last |
102 // modification if the value is non-null, the reader will check the underlying | 102 // 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 | 103 // 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 | 104 // if it does any succeeding read operations should fail with |
105 // ERR_UPLOAD_FILE_CHANGED error. | 105 // ERR_UPLOAD_FILE_CHANGED error. |
106 // This method itself does *not* check if the given path exists and is a | 106 // This method itself does *not* check if the given path exists and is a |
107 // regular file. | 107 // regular file. |
108 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 108 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
109 const FileSystemURL& url, | 109 const FileSystemURL& url, |
110 int64 offset, | 110 int64 offset, |
111 const base::Time& expected_modification_time, | 111 const base::Time& expected_modification_time, |
112 FileSystemContext* context) const = 0; | 112 FileSystemContext* context) const = 0; |
113 | 113 |
114 // Creates a new file stream writer for a given filesystem URL |url| with an | 114 // Creates a new file stream writer for a given filesystem URL |url| with an |
115 // offset |offset|. | 115 // offset |offset|. |
116 // This method itself does *not* check if the given path exists and is a | 116 // This method itself does *not* check if the given path exists and is a |
117 // regular file. | 117 // regular file. |
118 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 118 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
119 const FileSystemURL& url, | 119 const FileSystemURL& url, |
120 int64 offset, | 120 int64 offset, |
121 FileSystemContext* context) const = 0; | 121 FileSystemContext* context) const = 0; |
122 | 122 |
123 // Returns the specialized FileSystemQuotaUtil for this backend. | 123 // Returns the specialized FileSystemQuotaUtil for this backend. |
124 // This could return NULL if this backend does not support quota. | 124 // This could return NULL if this backend does not support quota. |
125 virtual FileSystemQuotaUtil* GetQuotaUtil() = 0; | 125 virtual FileSystemQuotaUtil* GetQuotaUtil() = 0; |
126 }; | 126 }; |
127 | 127 |
128 // An interface to control external file system access permissions. | 128 // An interface to control external file system access permissions. |
129 // TODO(satorux): Move this out of 'webkit/browser/fileapi'. crbug.com/257279 | 129 // TODO(satorux): Move this out of 'webkit/browser/fileapi'. crbug.com/257279 |
130 class ExternalFileSystemBackend : public FileSystemBackend { | 130 class ExternalFileSystemBackend : public FileSystemBackend { |
131 public: | 131 public: |
132 // Returns true if |url| is allowed to be accessed. | 132 // Returns true if |url| is allowed to be accessed. |
133 // This is supposed to perform ExternalFileSystem-specific security | 133 // This is supposed to perform ExternalFileSystem-specific security |
134 // checks. | 134 // checks. |
135 virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) const = 0; | 135 virtual bool IsAccessAllowed(const storage::FileSystemURL& url) const = 0; |
136 // Returns the list of top level directories that are exposed by this | 136 // Returns the list of top level directories that are exposed by this |
137 // provider. This list is used to set appropriate child process file access | 137 // provider. This list is used to set appropriate child process file access |
138 // permissions. | 138 // permissions. |
139 virtual std::vector<base::FilePath> GetRootDirectories() const = 0; | 139 virtual std::vector<base::FilePath> GetRootDirectories() const = 0; |
140 // Grants access to all external file system from extension identified with | 140 // Grants access to all external file system from extension identified with |
141 // |extension_id|. | 141 // |extension_id|. |
142 virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0; | 142 virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0; |
143 // Grants access to |virtual_path| from |origin_url|. | 143 // Grants access to |virtual_path| from |origin_url|. |
144 virtual void GrantFileAccessToExtension( | 144 virtual void GrantFileAccessToExtension( |
145 const std::string& extension_id, | 145 const std::string& extension_id, |
146 const base::FilePath& virtual_path) = 0; | 146 const base::FilePath& virtual_path) = 0; |
147 // Revokes file access from extension identified with |extension_id|. | 147 // Revokes file access from extension identified with |extension_id|. |
148 virtual void RevokeAccessForExtension( | 148 virtual void RevokeAccessForExtension( |
149 const std::string& extension_id) = 0; | 149 const std::string& extension_id) = 0; |
150 // Gets virtual path by known filesystem path. Returns false when filesystem | 150 // Gets virtual path by known filesystem path. Returns false when filesystem |
151 // path is not exposed by this provider. | 151 // path is not exposed by this provider. |
152 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 152 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
153 base::FilePath* virtual_path) = 0; | 153 base::FilePath* virtual_path) = 0; |
154 }; | 154 }; |
155 | 155 |
156 } // namespace fileapi | 156 } // namespace storage |
157 | 157 |
158 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 158 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |