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_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/file_path.h" | 11 #include "base/file_path.h" |
11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
12 #include "webkit/fileapi/file_system_mount_point_provider.h" | 13 #include "webkit/fileapi/file_system_mount_point_provider.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class MessageLoopProxy; | 18 class MessageLoopProxy; |
18 } | 19 } |
19 | 20 |
20 namespace fileapi { | 21 namespace fileapi { |
21 | 22 |
22 class SandboxMountPointProvider : public FileSystemMountPointProvider { | 23 class SandboxMountPointProvider : public FileSystemMountPointProvider { |
23 public: | 24 public: |
24 | 25 |
25 SandboxMountPointProvider( | 26 SandboxMountPointProvider( |
26 FileSystemPathManager* path_manager, | 27 FileSystemPathManager* path_manager, |
27 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 28 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
28 const FilePath& profile_path); | 29 const FilePath& profile_path); |
29 virtual ~SandboxMountPointProvider(); | 30 virtual ~SandboxMountPointProvider(); |
30 | 31 |
31 // Checks if mount point access is allowed from |origin_url|. | 32 // Checks if access to |virtual_path| is allowed from |origin_url|. |
32 virtual bool IsAccessAllowed(const GURL& origin_url); | 33 virtual bool IsAccessAllowed(const GURL& origin_url, |
| 34 FileSystemType type, |
| 35 const FilePath& virtual_path); |
33 | 36 |
34 // Retrieves the root path for the given |origin_url| and |type|, and | 37 // Retrieves the root path for the given |origin_url| and |type|, and |
35 // calls the given |callback| with the root path and name. | 38 // calls the given |callback| with the root path and name. |
36 // If |create| is true this also creates the directory if it doesn't exist. | 39 // If |create| is true this also creates the directory if it doesn't exist. |
37 virtual void GetFileSystemRootPath( | 40 virtual void GetFileSystemRootPath( |
38 const GURL& origin_url, | 41 const GURL& origin_url, |
39 FileSystemType type, | 42 FileSystemType type, |
40 bool create, | 43 bool create, |
41 FileSystemPathManager::GetRootPathCallback* callback); | 44 FileSystemPathManager::GetRootPathCallback* callback); |
42 | 45 |
43 // Like GetFileSystemRootPath, but synchronous, and can be called only while | 46 // Like GetFileSystemRootPath, but synchronous, and can be called only while |
44 // running on the file thread. | 47 // running on the file thread. |
45 virtual FilePath GetFileSystemRootPathOnFileThread( | 48 virtual FilePath GetFileSystemRootPathOnFileThread( |
46 const GURL& origin_url, | 49 const GURL& origin_url, |
47 FileSystemType type, | 50 FileSystemType type, |
48 const FilePath& unused, | 51 const FilePath& unused, |
49 bool create); | 52 bool create); |
50 | 53 |
51 // The FileSystem directory name. | 54 // The FileSystem directory name. |
52 static const FilePath::CharType kFileSystemDirectory[]; | 55 static const FilePath::CharType kFileSystemDirectory[]; |
53 | 56 |
54 static const char kPersistentName[]; | |
55 static const char kTemporaryName[]; | |
56 | |
57 const FilePath& base_path() const { | 57 const FilePath& base_path() const { |
58 return base_path_; | 58 return base_path_; |
59 } | 59 } |
60 | 60 |
61 // Checks if a given |name| contains any restricted names/chars in it. | 61 // Checks if a given |name| contains any restricted names/chars in it. |
62 virtual bool IsRestrictedFileName(const FilePath& filename) const; | 62 virtual bool IsRestrictedFileName(const FilePath& filename) const; |
63 | 63 |
| 64 virtual std::vector<FilePath> GetRootDirectories() const; |
| 65 |
64 // Returns the origin identifier string, which is used as a part of the | 66 // Returns the origin identifier string, which is used as a part of the |
65 // sandboxed path component, for the given |url|. | 67 // sandboxed path component, for the given |url|. |
66 static std::string GetOriginIdentifierFromURL(const GURL& url); | 68 static std::string GetOriginIdentifierFromURL(const GURL& url); |
67 | 69 |
68 // Gets a base directory path of the sandboxed filesystem that is | 70 // Gets a base directory path of the sandboxed filesystem that is |
69 // specified by |origin_identifier| and |type|. | 71 // specified by |origin_identifier| and |type|. |
70 // |base_path| must be pointing the FileSystem's data directory | 72 // |base_path| must be pointing the FileSystem's data directory |
71 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory. | 73 // under the profile directory, i.e. <profile_dir>/kFileSystemDirectory. |
72 // Returns an empty path if any of the given parameters are invalid. | 74 // Returns an empty path if any of the given parameters are invalid. |
73 // Returned directory path does not contain 'unique' part, therefore | 75 // Returned directory path does not contain 'unique' part, therefore |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 115 |
114 const FilePath base_path_; | 116 const FilePath base_path_; |
115 | 117 |
116 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 118 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
117 }; | 119 }; |
118 | 120 |
119 } // namespace fileapi | 121 } // namespace fileapi |
120 | 122 |
121 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 123 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
122 | 124 |
OLD | NEW |