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