Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: webkit/browser/fileapi/file_system_context.h

Issue 23856002: SyncFS: Support resolveLocalFileSystemURL on SyncFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add struct FileSystemInfo, and change file path manipulation Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class FileStreamReader; 42 class FileStreamReader;
43 } 43 }
44 44
45 namespace fileapi { 45 namespace fileapi {
46 46
47 class AsyncFileUtil; 47 class AsyncFileUtil;
48 class CopyOrMoveFileValidatorFactory; 48 class CopyOrMoveFileValidatorFactory;
49 class ExternalFileSystemBackend; 49 class ExternalFileSystemBackend;
50 class ExternalMountPoints; 50 class ExternalMountPoints;
51 class FileStreamWriter; 51 class FileStreamWriter;
52 class FileSystemBackend;
52 class FileSystemFileUtil; 53 class FileSystemFileUtil;
53 class FileSystemBackend;
54 class FileSystemOperation; 54 class FileSystemOperation;
55 class FileSystemOperationRunner; 55 class FileSystemOperationRunner;
56 class FileSystemOptions; 56 class FileSystemOptions;
57 class FileSystemQuotaUtil; 57 class FileSystemQuotaUtil;
58 class FileSystemURL; 58 class FileSystemURL;
59 class IsolatedFileSystemBackend; 59 class IsolatedFileSystemBackend;
60 class MountPoints; 60 class MountPoints;
61 class SandboxFileSystemBackend; 61 class SandboxFileSystemBackend;
62 62
63 struct DefaultContextDeleter; 63 struct DefaultContextDeleter;
64 struct FileSystemInfo;
64 65
65 // This class keeps and provides a file system context for FileSystem API. 66 // This class keeps and provides a file system context for FileSystem API.
66 // An instance of this class is created and owned by profile. 67 // An instance of this class is created and owned by profile.
67 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext 68 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext
68 : public base::RefCountedThreadSafe<FileSystemContext, 69 : public base::RefCountedThreadSafe<FileSystemContext,
69 DefaultContextDeleter> { 70 DefaultContextDeleter> {
70 public: 71 public:
71 // Returns file permission policy we should apply for the given |type|. 72 // Returns file permission policy we should apply for the given |type|.
72 // The return value must be bitwise-or'd of FilePermissionPolicy. 73 // The return value must be bitwise-or'd of FilePermissionPolicy.
73 // 74 //
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Returns a FileSystemBackend instance for external filesystem 148 // Returns a FileSystemBackend instance for external filesystem
148 // type, which is used only by chromeos for now. This is equivalent to 149 // type, which is used only by chromeos for now. This is equivalent to
149 // calling GetFileSystemBackend(kFileSystemTypeExternal). 150 // calling GetFileSystemBackend(kFileSystemTypeExternal).
150 ExternalFileSystemBackend* external_backend() const; 151 ExternalFileSystemBackend* external_backend() const;
151 152
152 // Used for OpenFileSystem. 153 // Used for OpenFileSystem.
153 typedef base::Callback<void(base::PlatformFileError result, 154 typedef base::Callback<void(base::PlatformFileError result,
154 const std::string& name, 155 const std::string& name,
155 const GURL& root)> OpenFileSystemCallback; 156 const GURL& root)> OpenFileSystemCallback;
156 157
158 // Used for ResolveURL.
159 typedef base::Callback<void(base::PlatformFileError result,
160 const FileSystemInfo& info,
161 const base::FilePath& file_path,
162 bool is_directory)> ResolveURLCallback;
163
157 // Used for DeleteFileSystem. 164 // Used for DeleteFileSystem.
158 typedef base::Callback<void(base::PlatformFileError result)> 165 typedef base::Callback<void(base::PlatformFileError result)>
159 DeleteFileSystemCallback; 166 DeleteFileSystemCallback;
160 167
161 // Opens the filesystem for the given |origin_url| and |type|, and dispatches 168 // Opens the filesystem for the given |origin_url| and |type|, and dispatches
162 // |callback| on completion. 169 // |callback| on completion.
163 // If |create| is true this may actually set up a filesystem instance 170 // If |create| is true this may actually set up a filesystem instance
164 // (e.g. by creating the root directory or initializing the database 171 // (e.g. by creating the root directory or initializing the database
165 // entry etc). 172 // entry etc).
166 void OpenFileSystem( 173 void OpenFileSystem(
167 const GURL& origin_url, 174 const GURL& origin_url,
168 FileSystemType type, 175 FileSystemType type,
169 OpenFileSystemMode mode, 176 OpenFileSystemMode mode,
170 const OpenFileSystemCallback& callback); 177 const OpenFileSystemCallback& callback);
171 178
179 // Opens the filesystem for the given |filesystem_url| as read-only, and then
180 // checks the existence of the file entry referred by the URL and its file
kinuko 2013/09/09 12:52:23 nit: file type -> filesystem type
nhiroki 2013/09/10 06:30:39 Done (deleted the part thanks to introducing FileS
181 // type.
182 void ResolveURL(
183 const FileSystemURL& url,
184 const ResolveURLCallback& callback);
185
172 // Deletes the filesystem for the given |origin_url| and |type|. This should 186 // Deletes the filesystem for the given |origin_url| and |type|. This should
173 // be called on the IO Thread. 187 // be called on the IO Thread.
174 void DeleteFileSystem( 188 void DeleteFileSystem(
175 const GURL& origin_url, 189 const GURL& origin_url,
176 FileSystemType type, 190 FileSystemType type,
177 const DeleteFileSystemCallback& callback); 191 const DeleteFileSystemCallback& callback);
178 192
179 // Creates new FileStreamReader instance to read a file pointed by the given 193 // Creates new FileStreamReader instance to read a file pointed by the given
180 // filesystem URL |url| starting from |offset|. |expected_modification_time| 194 // filesystem URL |url| starting from |offset|. |expected_modification_time|
181 // specifies the expected last modification if the value is non-null, the 195 // specifies the expected last modification if the value is non-null, the
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // FileSystemURL. 281 // FileSystemURL.
268 // 282 //
269 // If the original url does not point to an isolated or external filesystem, 283 // If the original url does not point to an isolated or external filesystem,
270 // returns the original url, without attempting to crack it. 284 // returns the original url, without attempting to crack it.
271 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; 285 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const;
272 286
273 // For initial backend_map construction. This must be called only from 287 // For initial backend_map construction. This must be called only from
274 // the constructor. 288 // the constructor.
275 void RegisterBackend(FileSystemBackend* backend); 289 void RegisterBackend(FileSystemBackend* backend);
276 290
291 void DidOpenFileSystemForResolveURL(
292 const FileSystemURL& url,
293 const ResolveURLCallback& callback,
294 const GURL& filesystem_root,
295 const std::string& filesystem_name,
296 base::PlatformFileError error);
297 void DidGetMetadataForResolveURL(
298 const base::FilePath& path,
299 const FileSystemContext::ResolveURLCallback& callback,
300 const FileSystemInfo& info,
301 base::PlatformFileError error,
302 const base::PlatformFileInfo& file_info);
303
277 // Returns a FileSystemBackend, used only by test code. 304 // Returns a FileSystemBackend, used only by test code.
278 SandboxFileSystemBackend* sandbox_backend() const { 305 SandboxFileSystemBackend* sandbox_backend() const {
279 return sandbox_backend_.get(); 306 return sandbox_backend_.get();
280 } 307 }
281 308
282 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 309 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
283 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; 310 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_;
284 311
285 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 312 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
286 313
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 348
322 struct DefaultContextDeleter { 349 struct DefaultContextDeleter {
323 static void Destruct(const FileSystemContext* context) { 350 static void Destruct(const FileSystemContext* context) {
324 context->DeleteOnCorrectThread(); 351 context->DeleteOnCorrectThread();
325 } 352 }
326 }; 353 };
327 354
328 } // namespace fileapi 355 } // namespace fileapi
329 356
330 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 357 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698