Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | 12 #include "base/platform_file.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace base { | |
| 19 class MessageLoopProxy; | |
| 20 } | |
| 21 | |
| 18 namespace fileapi { | 22 namespace fileapi { |
| 19 | 23 |
| 24 class FileSystemCallbackDispatcher; | |
| 25 class FileSystemContext; | |
| 20 class FileSystemFileUtil; | 26 class FileSystemFileUtil; |
| 27 class FileSystemOperationInterface; | |
| 21 | 28 |
| 22 // An interface to provide mount-point-specific path-related utilities | 29 // An interface to provide mount-point-specific path-related utilities |
| 23 // and specialized FileSystemFileUtil instance. | 30 // and specialized FileSystemFileUtil instance. |
| 24 class FileSystemMountPointProvider { | 31 class FileSystemMountPointProvider { |
| 25 public: | 32 public: |
| 26 // Callback for ValidateFileSystemRoot. | 33 // Callback for ValidateFileSystemRoot. |
| 27 typedef base::Callback<void(base::PlatformFileError error)> | 34 typedef base::Callback<void(base::PlatformFileError error)> |
| 28 ValidateFileSystemCallback; | 35 ValidateFileSystemCallback; |
| 29 virtual ~FileSystemMountPointProvider() {} | 36 virtual ~FileSystemMountPointProvider() {} |
| 30 | 37 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 58 // Callable on any thread. | 65 // Callable on any thread. |
| 59 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; | 66 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; |
| 60 | 67 |
| 61 // Returns the list of top level directories that are exposed by this | 68 // Returns the list of top level directories that are exposed by this |
| 62 // provider. This list is used to set appropriate child process file access | 69 // provider. This list is used to set appropriate child process file access |
| 63 // permissions. | 70 // permissions. |
| 64 virtual std::vector<FilePath> GetRootDirectories() const = 0; | 71 virtual std::vector<FilePath> GetRootDirectories() const = 0; |
| 65 | 72 |
| 66 // Returns the specialized FileSystemFileUtil for this mount point. | 73 // Returns the specialized FileSystemFileUtil for this mount point. |
| 67 virtual FileSystemFileUtil* GetFileUtil() = 0; | 74 virtual FileSystemFileUtil* GetFileUtil() = 0; |
| 75 | |
| 76 // Returns a new instance of the specialized FileSystemOperation for this | |
| 77 // mount point based on the given |url|. | |
| 78 virtual FileSystemOperationInterface* CreateFileSystemOperation( | |
|
satorux1
2011/12/27 20:55:34
There is also FileSystemContext::CreateFileSystemO
kinuko
2012/01/13 08:28:35
Added some comments why we have both. We can get
| |
| 79 const GURL& url, | |
| 80 FileSystemCallbackDispatcher* dispatcher, | |
| 81 base::MessageLoopProxy* file_proxy, | |
| 82 FileSystemContext* context) const = 0; | |
| 68 }; | 83 }; |
| 69 | 84 |
| 70 // An interface to control external file system access permissions. | 85 // An interface to control external file system access permissions. |
| 71 class ExternalFileSystemMountPointProvider | 86 class ExternalFileSystemMountPointProvider |
| 72 : public FileSystemMountPointProvider { | 87 : public FileSystemMountPointProvider { |
| 73 public: | 88 public: |
| 74 // Grant access to all external file system from extension identified with | 89 // Grant access to all external file system from extension identified with |
| 75 // |extension_id|. | 90 // |extension_id|. |
| 76 virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0; | 91 virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0; |
| 77 // Grants access to |virtual_path| from |origin_url|. | 92 // Grants access to |virtual_path| from |origin_url|. |
| 78 virtual void GrantFileAccessToExtension( | 93 virtual void GrantFileAccessToExtension( |
| 79 const std::string& extension_id, | 94 const std::string& extension_id, |
| 80 const FilePath& virtual_path) = 0; | 95 const FilePath& virtual_path) = 0; |
| 81 // Revoke file access from extension identified with |extension_id|. | 96 // Revoke file access from extension identified with |extension_id|. |
| 82 virtual void RevokeAccessForExtension( | 97 virtual void RevokeAccessForExtension( |
| 83 const std::string& extension_id) = 0; | 98 const std::string& extension_id) = 0; |
| 84 // Adds a new mount point. | 99 // Adds a new mount point. |
| 85 virtual void AddMountPoint(FilePath mount_point) = 0; | 100 virtual void AddMountPoint(FilePath mount_point) = 0; |
| 86 // Remove a mount point. | 101 // Remove a mount point. |
| 87 virtual void RemoveMountPoint(FilePath mount_point) = 0; | 102 virtual void RemoveMountPoint(FilePath mount_point) = 0; |
| 88 // Gets virtual path by known filesystem path. Returns false when filesystem | 103 // Gets virtual path by known filesystem path. Returns false when filesystem |
| 89 // path is not exposed by this provider. | 104 // path is not exposed by this provider. |
| 90 virtual bool GetVirtualPath(const FilePath& filesystem_path, | 105 virtual bool GetVirtualPath(const FilePath& filesystem_path, |
| 91 FilePath* virtual_path) = 0; | 106 FilePath* virtual_path) = 0; |
| 92 }; | 107 }; |
| 93 | 108 |
| 94 } // namespace fileapi | 109 } // namespace fileapi |
| 95 | 110 |
| 96 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |