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

Side by Side Diff: webkit/fileapi/file_system_mount_point_provider.h

Issue 9016020: Cleanup FileSystemOperation for preparing for adding FSO-factory method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 11 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_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ 6 #define WEBKIT_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/platform_file.h"
tzik 2012/01/10 08:31:13 sort?
kinuko 2012/01/10 09:48:53 Done.
12 #include "base/file_path.h" 13 #include "base/file_path.h"
13 #include "webkit/fileapi/file_system_types.h" 14 #include "webkit/fileapi/file_system_types.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace fileapi { 18 namespace fileapi {
18 19
19 class FileSystemFileUtil; 20 class FileSystemFileUtil;
20 21
21 // An interface to provide mount-point-specific path-related utilities 22 // An interface to provide mount-point-specific path-related utilities
22 // and specialized FileSystemFileUtil instance. 23 // and specialized FileSystemFileUtil instance.
23 class FileSystemMountPointProvider { 24 class FileSystemMountPointProvider {
24 public: 25 public:
25 // Callback for GetFileSystemRootPath. 26 // Callback for ValidateFileSystemRoot.
26 // If the request is accepted and the root filesystem for the origin exists 27 typedef base::Callback<void(base::PlatformFileError error)>
27 // the callback is called with success=true and valid root_path and name. 28 ValidateFileSystemCallback;
28 // If the request is accepted, |create| is specified for
29 // GetFileSystemRootPath, and the root directory does not exist, it creates
30 // a new one and calls back with success=true if the creation has succeeded.
31 typedef base::Callback<void(bool /* success */,
32 const FilePath& /* root_path */,
33 const std::string& /* name */)>
34 GetRootPathCallback;
35 virtual ~FileSystemMountPointProvider() {} 29 virtual ~FileSystemMountPointProvider() {}
36 30
31 // Validates the filesystem for the given |origin_url| and |type|.
32 // This verifies if it is allowed to request (or create) the filesystem
33 // and if it can access (or create) the root directory of the mount point.
34 // If |create| is true this may also create the root directory for
35 // the filesystem if it doesn't exist.
36 virtual void ValidateFileSystemRoot(
37 const GURL& origin_url,
38 FileSystemType type,
39 bool create,
40 const ValidateFileSystemCallback& callback) = 0;
41
42 // Retrieves the root path of the filesystem specified by the given
43 // |origin_url| and |type| on the file thread.
44 // If |create| is true this may also create the root directory for
45 // the filesystem if it doesn't exist.
46 virtual FilePath GetFileSystemRootPathOnFileThread(
47 const GURL& origin_url,
48 FileSystemType type,
49 const FilePath& virtual_path,
50 bool create) = 0;
51
37 // Checks if access to |virtual_path| is allowed from |origin_url|. 52 // Checks if access to |virtual_path| is allowed from |origin_url|.
38 virtual bool IsAccessAllowed(const GURL& origin_url, 53 virtual bool IsAccessAllowed(const GURL& origin_url,
39 FileSystemType type, 54 FileSystemType type,
40 const FilePath& virtual_path) = 0; 55 const FilePath& virtual_path) = 0;
41 56
42 // Retrieves the root path for the given |origin_url| and |type|, and
43 // calls the given |callback| with the root path and name.
44 // If |create| is true this also creates the directory if it doesn't exist.
45 virtual void ValidateFileSystemRootAndGetURL(
46 const GURL& origin_url,
47 FileSystemType type,
48 bool create,
49 const GetRootPathCallback& callback) = 0;
50
51 // Like GetFileSystemRootPath, but synchronous, and can be called only while
52 // running on the file thread.
53 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread(
54 const GURL& origin_url,
55 FileSystemType type,
56 const FilePath& virtual_path,
57 bool create) = 0;
58
59 // Checks if a given |name| contains any restricted names/chars in it. 57 // Checks if a given |name| contains any restricted names/chars in it.
60 // Callable on any thread. 58 // Callable on any thread.
61 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; 59 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0;
62 60
63 // Returns the list of top level directories that are exposed by this 61 // Returns the list of top level directories that are exposed by this
64 // provider. This list is used to set appropriate child process file access 62 // provider. This list is used to set appropriate child process file access
65 // permissions. 63 // permissions.
66 virtual std::vector<FilePath> GetRootDirectories() const = 0; 64 virtual std::vector<FilePath> GetRootDirectories() const = 0;
67 65
68 // Returns the specialized FileSystemFileUtil for this mount point. 66 // Returns the specialized FileSystemFileUtil for this mount point.
(...skipping 20 matching lines...) Expand all
89 virtual void RemoveMountPoint(FilePath mount_point) = 0; 87 virtual void RemoveMountPoint(FilePath mount_point) = 0;
90 // Gets virtual path by known filesystem path. Returns false when filesystem 88 // Gets virtual path by known filesystem path. Returns false when filesystem
91 // path is not exposed by this provider. 89 // path is not exposed by this provider.
92 virtual bool GetVirtualPath(const FilePath& filesystem_path, 90 virtual bool GetVirtualPath(const FilePath& filesystem_path,
93 FilePath* virtual_path) = 0; 91 FilePath* virtual_path) = 0;
94 }; 92 };
95 93
96 } // namespace fileapi 94 } // namespace fileapi
97 95
98 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ 96 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698