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 <vector> | |
| 9 | |
| 8 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 9 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 10 #include "webkit/fileapi/file_system_path_manager.h" | 12 #include "webkit/fileapi/file_system_path_manager.h" |
| 11 #include "webkit/fileapi/file_system_types.h" | 13 #include "webkit/fileapi/file_system_types.h" |
| 12 | 14 |
| 13 namespace fileapi { | 15 namespace fileapi { |
| 14 | 16 |
| 15 // An interface to provide local filesystem paths. | 17 // An interface to provide local filesystem paths. |
| 16 | 18 |
| 17 class FileSystemMountPointProvider { | 19 class FileSystemMountPointProvider { |
| 18 public: | 20 public: |
| 19 virtual ~FileSystemMountPointProvider() {} | 21 virtual ~FileSystemMountPointProvider() {} |
| 20 | 22 |
| 21 // Checks if mount point access is allowed from |origin_url|. | 23 // Checks if access to |virtual_path| is allowed from |origin_url|. |
| 22 virtual bool IsAccessAllowed(const GURL& origin_url) = 0; | 24 virtual bool IsAccessAllowed(const GURL& origin_url, |
| 25 const FilePath& virtual_path) = 0; | |
| 26 | |
| 27 // Checks if access to |virtual_path| is allowed from |origin_url|. | |
|
ericu
2011/04/08 02:12:14
Copy/paste of comment.
zel
2011/04/08 04:16:36
Done.
| |
| 28 virtual void GrantAccess(const GURL& origin_url, | |
| 29 const FilePath& virtual_path) = 0; | |
| 23 | 30 |
| 24 // Retrieves the root path for the given |origin_url| and |type|, and | 31 // Retrieves the root path for the given |origin_url| and |type|, and |
| 25 // calls the given |callback| with the root path and name. | 32 // calls the given |callback| with the root path and name. |
| 26 // If |create| is true this also creates the directory if it doesn't exist. | 33 // If |create| is true this also creates the directory if it doesn't exist. |
| 27 virtual void GetFileSystemRootPath( | 34 virtual void GetFileSystemRootPath( |
| 28 const GURL& origin_url, | 35 const GURL& origin_url, |
| 29 FileSystemType type, | 36 FileSystemType type, |
| 30 bool create, | 37 bool create, |
| 31 FileSystemPathManager::GetRootPathCallback* callback) = 0; | 38 FileSystemPathManager::GetRootPathCallback* callback) = 0; |
| 32 | 39 |
| 33 // Like GetFileSystemRootPath, but synchronous, and can be called only while | 40 // Like GetFileSystemRootPath, but synchronous, and can be called only while |
| 34 // running on the file thread. | 41 // running on the file thread. |
| 35 virtual FilePath GetFileSystemRootPathOnFileThread( | 42 virtual FilePath GetFileSystemRootPathOnFileThread( |
| 36 const GURL& origin_url, | 43 const GURL& origin_url, |
| 37 FileSystemType type, | 44 FileSystemType type, |
| 38 const FilePath& virtual_path, | 45 const FilePath& virtual_path, |
| 39 bool create) = 0; | 46 bool create) = 0; |
| 40 | 47 |
| 41 // Checks if a given |name| contains any restricted names/chars in it. | 48 // Checks if a given |name| contains any restricted names/chars in it. |
| 42 // Callable on any thread. | 49 // Callable on any thread. |
| 43 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; | 50 virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; |
| 51 | |
| 52 // Returns the list of top level directories that are exposed by this | |
| 53 // provider. This list is used to set appropriate child process file access | |
| 54 // permissions. | |
| 55 virtual std::vector<FilePath> GetRootDirectories() const = 0; | |
| 44 }; | 56 }; |
| 45 | 57 |
| 46 } // namespace fileapi | 58 } // namespace fileapi |
| 47 | 59 |
| 48 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 60 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
| 49 | 61 |
| OLD | NEW |